0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/client/controllers/posts/post.js
Matt Enlow 6f929eee4a Emberify Posts mobile transitions
Closes #3950

- Fixed up event attachment and removal in a few mixins
- Renamed content-list-content-view to something more understandable
- simplify transition from posts.index to posts.post
2014-09-10 20:58:10 -06:00

31 lines
1.2 KiB
JavaScript

import {mobileQuery} from 'ghost/utils/mobile';
var PostController = Ember.ObjectController.extend({
isPublished: Ember.computed.equal('status', 'published'),
classNameBindings: ['featured'],
actions: {
toggleFeatured: function () {
var options = {disableNProgress: true},
self = this;
this.toggleProperty('featured');
this.get('model').save(options).catch(function (errors) {
self.notifications.showErrors(errors);
});
},
hidePostContent: function () {
if (mobileQuery.matches) {
$('.js-content-list').animate({right: '0', left: '0', 'margin-right': '0'}, 300);
$('.js-content-preview').animate({right: '-100%', left: '100%', 'margin-left': '15px'}, 300);
}
},
showPostContent: function () {
if (mobileQuery.matches) {
$('.js-content-list').animate({right: '100%', left: '-100%', 'margin-right': '15px'}, 300);
$('.js-content-preview').animate({right: '0', left: '0', 'margin-left': '0'}, 300);
}
}
}
});
export default PostController;