2014-08-06 07:26:22 +04:00
|
|
|
import {mobileQuery, responsiveAction} from 'ghost/utils/mobile';
|
2014-06-24 10:19:20 +04:00
|
|
|
|
|
|
|
var PostsView = Ember.View.extend({
|
2014-08-01 10:47:29 +04:00
|
|
|
target: Ember.computed.alias('controller'),
|
2014-06-24 10:19:20 +04:00
|
|
|
classNames: ['content-view-container'],
|
|
|
|
tagName: 'section',
|
|
|
|
|
|
|
|
mobileInteractions: function () {
|
|
|
|
Ember.run.scheduleOnce('afterRender', this, function () {
|
2014-08-01 10:47:29 +04:00
|
|
|
var self = this;
|
2014-08-06 07:26:22 +04:00
|
|
|
|
|
|
|
$(window).resize(function () {
|
|
|
|
if (!mobileQuery.matches) {
|
|
|
|
self.send('resetContentPreview');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-08-11 13:25:30 +04:00
|
|
|
// ### Add the blog URL to the <a> version of the ghost logo
|
|
|
|
$('.ghost-logo-link').attr('href', this.get('controller.ghostPaths').blogRoot);
|
|
|
|
|
2014-06-24 10: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 10:47:29 +04:00
|
|
|
self.send('showContentPreview');
|
2014-06-24 10: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 10:47:29 +04:00
|
|
|
self.send('hideContentPreview');
|
2014-06-24 10:19:20 +04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}.on('didInsertElement'),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default PostsView;
|