Skip to content
This repository
Browse code

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

…hods on the individual panels
  • Loading branch information...
commit c06d52dce26d4ed06443e527eb12d762265a71e3 1 parent 5062dd9
Ingo Schommer authored July 21, 2011
7  admin/javascript/LeftAndMain.Content.js
@@ -47,6 +47,10 @@
47 47
 				this._super();
48 48
 			},
49 49
 			
  50
+			redraw: function() {
  51
+				this.layout();
  52
+			},
  53
+			
50 54
 			/**
51 55
 			 * Function: loadForm
52 56
 			 * 
@@ -73,8 +77,6 @@
73 77
 
74 78
 				this.trigger('loadform', {form: form, url: url});
75 79
 			
76  
-				form.cleanup();
77  
-
78 80
 				return jQuery.ajax(jQuery.extend({
79 81
 					url: url, 
80 82
 					// Ensure that form view is loaded (rather than whole "Content" template)
@@ -203,7 +205,6 @@
203 205
 			 * @return {jQuery} New form element
204 206
 			 */
205 207
 			replaceForm: function(form, html) {
206  
-				form.cleanup();
207 208
 				if(html) {
208 209
 					var parent = form.parent(), id = form.attr('id');
209 210
 					form.replaceWith(html);
7  admin/javascript/LeftAndMain.EditForm.js
@@ -89,6 +89,13 @@
89 89
 				this._super();
90 90
 			},
91 91
 			
  92
+			redraw: function() {
  93
+				// TODO Manually set container height before resizing - shouldn't be necessary'
  94
+				this.find('.cms-content-actions').height(this.find('.cms-content-actions .Actions').height());
  95
+				
  96
+				this.layout();
  97
+			},
  98
+			
92 99
 			/**
93 100
 			 * Function: _setupChangeTracker
94 101
 			 */
12  admin/javascript/LeftAndMain.js
@@ -58,7 +58,7 @@
58 58
 					return;
59 59
 				}
60 60
 				
61  
-				// Initialize layouts, inner to outer
  61
+				// Initialize layouts
62 62
 				this.redraw();
63 63
 				$(window).resize(function() {self.redraw()});
64 64
 				
@@ -77,10 +77,12 @@
77 77
 			},
78 78
 			
79 79
 			redraw: function() {
80  
-				// Not all edit forms are layouted
81  
-				var editForm = $('.cms-edit-form[data-layout]').layout();
82  
-				$('.cms-content').layout();
83  
-				$('.cms-container').layout({resize: false});
  80
+				// Move from inner to outer layouts. Some of the elements might not exist.
  81
+				this.find('.cms-edit-form[data-layout]').redraw(); // Not all edit forms are layouted
  82
+				this.find('.cms-preview').redraw();
  83
+				this.find('.cms-content').redraw();
  84
+				
  85
+				this.layout({resize: false});
84 86
 			},
85 87
 			
86 88
 			/**
5  javascript/TabSet.js
@@ -9,11 +9,12 @@
9 9
 		 */
10 10
 		$('.ss-tabset').entwine({
11 11
 			onmatch: function() {
12  
-				this.redraw();
  12
+				// Can't name redraw() as it clashes with other CMS entwine classes
  13
+				this.redrawTabs();
13 14
 				this._super();
14 15
 			},
15 16
 			
16  
-			redraw: function() {
  17
+			redrawTabs: function() {
17 18
 				this.rewriteHashlinks();
18 19
 
19 20
 				// Initialize jQuery UI tabs

0 notes on commit c06d52d

Please sign in to comment.
Something went wrong with that request. Please try again.