Permalink
Browse files

MINOR Delegated JavaScript layout from .cms-container to redraw() met…

…hods on the individual panels
  • Loading branch information...
1 parent 5062dd9 commit c06d52dce26d4ed06443e527eb12d762265a71e3 @chillu chillu committed Jul 21, 2011
@@ -47,6 +47,10 @@
this._super();
},
+ redraw: function() {
+ this.layout();
+ },
+
/**
* Function: loadForm
*
@@ -73,8 +77,6 @@
this.trigger('loadform', {form: form, url: url});
- form.cleanup();
-
return jQuery.ajax(jQuery.extend({
url: url,
// Ensure that form view is loaded (rather than whole "Content" template)
@@ -203,7 +205,6 @@
* @return {jQuery} New form element
*/
replaceForm: function(form, html) {
- form.cleanup();
if(html) {
var parent = form.parent(), id = form.attr('id');
form.replaceWith(html);
@@ -89,6 +89,13 @@
this._super();
},
+ redraw: function() {
+ // TODO Manually set container height before resizing - shouldn't be necessary'
+ this.find('.cms-content-actions').height(this.find('.cms-content-actions .Actions').height());
+
+ this.layout();
+ },
+
/**
* Function: _setupChangeTracker
*/
@@ -58,7 +58,7 @@
return;
}
- // Initialize layouts, inner to outer
+ // Initialize layouts
this.redraw();
$(window).resize(function() {self.redraw()});
@@ -77,10 +77,12 @@
},
redraw: function() {
- // Not all edit forms are layouted
- var editForm = $('.cms-edit-form[data-layout]').layout();
- $('.cms-content').layout();
- $('.cms-container').layout({resize: false});
+ // Move from inner to outer layouts. Some of the elements might not exist.
+ this.find('.cms-edit-form[data-layout]').redraw(); // Not all edit forms are layouted
+ this.find('.cms-preview').redraw();
+ this.find('.cms-content').redraw();
+
+ this.layout({resize: false});
},
/**
@@ -9,11 +9,12 @@
*/
$('.ss-tabset').entwine({
onmatch: function() {
- this.redraw();
+ // Can't name redraw() as it clashes with other CMS entwine classes
+ this.redrawTabs();
this._super();
},
- redraw: function() {
+ redrawTabs: function() {
this.rewriteHashlinks();
// Initialize jQuery UI tabs

0 comments on commit c06d52d

Please sign in to comment.