MINOR Delegated JavaScript layout from .cms-container to redraw() methods on the individual panels

This commit is contained in:
Ingo Schommer 2011-07-21 18:39:26 +02:00
parent 5062dd9393
commit c06d52dce2
4 changed files with 21 additions and 10 deletions

View File

@ -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);

View File

@ -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
*/

View File

@ -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});
},
/**

View File

@ -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