2014-08-05 23:26:22 -04:00
|
|
|
import {mobileQuery, responsiveAction} from 'ghost/utils/mobile';
|
2014-06-24 02:19:20 -04:00
|
|
|
|
|
|
|
var PostsView = Ember.View.extend({
|
2014-08-01 02:47:29 -04:00
|
|
|
target: Ember.computed.alias('controller'),
|
2014-06-24 02:19:20 -04:00
|
|
|
classNames: ['content-view-container'],
|
|
|
|
tagName: 'section',
|
|
|
|
|
|
|
|
mobileInteractions: function () {
|
|
|
|
Ember.run.scheduleOnce('afterRender', this, function () {
|
2014-08-01 02:47:29 -04:00
|
|
|
var self = this;
|
2014-08-05 23:26:22 -04:00
|
|
|
|
|
|
|
$(window).resize(function () {
|
|
|
|
if (!mobileQuery.matches) {
|
|
|
|
self.send('resetContentPreview');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-06-24 02:19:20 -04:00
|
|
|
// ### Show content preview when swiping left on content list
|
|
|
|
$('.manage').on('click', '.content-list ol li', function (event) {
|
|
|
|
responsiveAction(event, '(max-width: 800px)', function () {
|
2014-08-01 02:47:29 -04:00
|
|
|
self.send('showContentPreview');
|
2014-06-24 02:19:20 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// ### Hide content preview
|
|
|
|
$('.manage').on('click', '.content-preview .button-back', function (event) {
|
|
|
|
responsiveAction(event, '(max-width: 800px)', function () {
|
2014-08-01 02:47:29 -04:00
|
|
|
self.send('hideContentPreview');
|
2014-06-24 02:19:20 -04:00
|
|
|
});
|
|
|
|
});
|
2014-08-08 13:53:56 +02:00
|
|
|
$('[data-off-canvas]').attr('href', this.get('controller.ghostPaths.blogRoot'));
|
2014-06-24 02:19:20 -04:00
|
|
|
});
|
|
|
|
}.on('didInsertElement'),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default PostsView;
|