Permalink
Browse files

BUGFIX Fixed cms menu expansion logic when shown alongside preview pa…

…nel, retain cookie preference
  • Loading branch information...
1 parent e185a9b commit d23e8ec14c3b60dbf654e72d2950bad66768c563 @chillu chillu committed May 16, 2012
Showing with 14 additions and 5 deletions.
  1. +14 −5 admin/javascript/LeftAndMain.Preview.js
@@ -69,15 +69,18 @@
updateAfterXhr();
});
- // Toggle preview when new menu entry is selected
+ // Toggle preview when new menu entry is selected.
+ // Only do this when preview is actually shown,
+ // to avoid auto-expanding the menu in normal CMS mode
$('.cms-menu-list li').bind('select', function(e) {
- self.collapse();
+ if(!self.hasClass('is-collapsed')) self.collapse();
});
this.layout({type: 'border'});
if(this.hasClass('is-expanded')) this.expand();
else this.collapse();
+ this.data('cms-preview-initialized', true);
// Preview might not be available in all admin interfaces - block/disable when necessary
this.append('<div class="cms-preview-overlay ui-widget-overlay-light"></div>');
@@ -142,15 +145,18 @@
}
},
- expand: function() {
+ expand: function(inclMenu) {
var self = this, containerEl = this.getLayoutContainer(), contentEl = containerEl.find('.cms-content');
this.removeClass('east').addClass('center').removeClass('is-collapsed');
// this.css('overflow', 'auto');
contentEl.removeClass('center').hide();
this.find('iframe').show();
this.find('.cms-preview-toggle a').html('&raquo;');
this.find('.cms-preview-controls').show();
- containerEl.find('.cms-menu').collapsePanel();
+
+ if(this.data('cms-preview-initialized')) {
+ containerEl.find('.cms-menu').collapsePanel();
+ }
// Already triggered through panel toggle above
// containerEl.redraw();
@@ -164,7 +170,10 @@
this.find('iframe').hide();
this.find('.cms-preview-toggle a').html('&laquo;');
this.find('.cms-preview-controls').hide();
- containerEl.find('.cms-menu').expandPanel();
+
+ if(this.data('cms-preview-initialized')) {
+ containerEl.find('.cms-menu').expandPanel();
+ }
// Already triggered through panel toggle above
// containerEl.redraw();

0 comments on commit d23e8ec

Please sign in to comment.