Restore original display after window resizing.

fixes #3597
This commit is contained in:
Robert Jackson 2014-08-05 23:26:22 -04:00 committed by Hannah Wolfe
parent 6ed629b410
commit 0a9bde7702
2 changed files with 13 additions and 1 deletions

View File

@ -75,6 +75,11 @@ var PostsController = Ember.ArrayController.extend(PaginationControllerMixin, {
},
actions: {
resetContentPreview: function () {
$('.content-list').removeAttr('style');
$('.content-preview').removeAttr('style');
},
showContentPreview: function () {
$('.content-list').animate({right: '100%', left: '-100%', 'margin-right': '15px'}, 300);
$('.content-preview').animate({right: '0', left: '0', 'margin-left': '0'}, 300);

View File

@ -1,4 +1,4 @@
import {responsiveAction} from 'ghost/utils/mobile';
import {mobileQuery, responsiveAction} from 'ghost/utils/mobile';
var PostsView = Ember.View.extend({
target: Ember.computed.alias('controller'),
@ -8,6 +8,13 @@ var PostsView = Ember.View.extend({
mobileInteractions: function () {
Ember.run.scheduleOnce('afterRender', this, function () {
var self = this;
$(window).resize(function () {
if (!mobileQuery.matches) {
self.send('resetContentPreview');
}
});
// ### Show content preview when swiping left on content list
$('.manage').on('click', '.content-list ol li', function (event) {
responsiveAction(event, '(max-width: 800px)', function () {