Poprawienie nazwy zmiennej "availble_themes" -> "available_themes".
[redakcja.git] / platforma / static / js / views / view.js
index e9ff938..9441fc5 100644 (file)
@@ -21,9 +21,9 @@ var View = Editor.Object.extend({
         $(this.element).bind('resize', this._resizeHandler);
     },
 
         $(this.element).bind('resize', this._resizeHandler);
     },
 
-    render: function() {
+    render: function(template) {
         console.log('rendering:', this._className);
         console.log('rendering:', this._className);
-        this.element.html(render_template(this.template, this));
+        this.element.html(render_template(template || this.template, this));
     },
   
     frozen: function() {
     },
   
     frozen: function() {
@@ -34,28 +34,22 @@ var View = Editor.Object.extend({
         if (this.frozen()) {
             this.unfreeze();
         }
         if (this.frozen()) {
             this.unfreeze();
         }
-        this.overlay = this.overlay
-        || $('<div><div>' + message + '</div></div>')
-        .addClass(this.overlayClass)
+        this.overlay = this.overlay || $('<div><div>' + message + '</div></div>');
+
+        this.overlay.addClass(this.overlayClass)
         .css({
         .css({
-            position: 'absolute',
-            width: this.element.width(),
-            height: this.element.height(),
-            top: this.element.position().top,
-            left: this.element.position().left,
-            'user-select': 'none',
-            '-webkit-user-select': 'none',
-            '-khtml-user-select': 'none',
-            '-moz-user-select': 'none',
-            overflow: 'hidden'
-        })
-        .attr('unselectable', 'on')
-        .appendTo(this.element.parent());
             
             
+        }).attr('unselectable', 'on')
+
+        this.overlay.appendTo(this.element);
+
+        var ovc = this.overlay.children('div');        
+        var padV = (this.overlay.height() - ovc.outerHeight())/2;
+        var padH = (this.overlay.width() - ovc.outerWidth())/2;
+                   
         this.overlay.children('div').css({
         this.overlay.children('div').css({
-            position: 'relative',
-            top: this.overlay.height() / 2 - 20
-        });
+            top: padV, left: padH
+        });    
     },
   
     unfreeze: function() {
     },
   
     unfreeze: function() {
@@ -66,16 +60,14 @@ var View = Editor.Object.extend({
     },
 
     resized: function(event) {
     },
 
     resized: function(event) {
-        if (this.frozen()) {
-            this.overlay.css({
-                position: 'absolute',
-                width: this.element.width(),
-                height: this.element.height(),
-                top: this.element.position().top,
-                left: this.element.position().left
-            }).children('div').css({
-                position: 'relative',
-                top: this.overlay.height() / 2 - 20
+        if(this.overlay) {
+            var ovc = this.overlay.children('div');
+            var padV = (this.overlay.height() - ovc.outerHeight())/2;
+            var padH = (this.overlay.width() - ovc.outerWidth())/2;
+
+            this.overlay.children('div').css({
+                top: padV,
+                left: padH
             });
         }
     },
             });
         }
     },
@@ -87,4 +79,4 @@ var View = Editor.Object.extend({
         this.unfreeze();
         this.element.html('');
     }
         this.unfreeze();
         this.element.html('');
     }
-});
+});
\ No newline at end of file