]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
WEBUI: grid add - fix dialog center
authorJaroslav Kysela <perex@perex.cz>
Sat, 21 Nov 2015 16:55:52 +0000 (17:55 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sat, 21 Nov 2015 16:55:52 +0000 (17:55 +0100)
src/webui/static/app/extensions.js
src/webui/static/app/idnode.js

index 7abb95f117b30d1ca6cec1cc038dd46b3dd14662..1a58dbd34262c1c2510c6f2287ee3bfb90482168 100644 (file)
@@ -1771,15 +1771,11 @@ Ext.ux.Window = Ext.extend(Ext.Window, {
     var ah = Ext.lib.Dom.getViewHeight();
     var c = 0;
 
-    if (w > 200 && this.originalWidth === 0)
-      this.originalWidth = w;
-    else if (resize && this.originalWidth) {
+    if (resize && this.originalWidth) {
       w = this.originalWidth;
       c = 1;
     }
-    if (h > 100 && this.originalHeight === 0)
-      this.originalHeight = h;
-    else if (resize && this.originalHeight) {
+    if (resize && this.originalHeight) {
       h = this.originalHeight;
       c = 1;
     }
@@ -1801,10 +1797,25 @@ Ext.ux.Window = Ext.extend(Ext.Window, {
       this.center();
     } else if (resize) {
       this.center();
+    } else {
+      return false;
     }
+    return true;
+  },
+
+  setOriginSize : function(force) {
+    var w = this.getWidth();
+    var h = this.getHeight();
+    if (w > 200 && (force || this.originalWidth === 0))
+      this.originalWidth = w;
+    if (h > 100 && (force || this.originalHeight === 0))
+      this.originalHeight = h;
+    if (force && this.keepItVisible() === false)
+      this.center();
   },
 
   onShow : function() {
+    this.setOriginSize(false);
     this.keepItVisible();
   },
 
index 72d3f1a746233abe2639e6dbb6dacc7b94fe572b..4259121af80c41b8d3d7e9b21800e19ec1304e97 100644 (file)
@@ -921,6 +921,15 @@ tvheadend.idnode_editor = function(item, conf)
 
     /* Buttons */
     if (!conf.noButtons) {
+        if (conf.cancel) {
+            var cancelBtn = new Ext.Button({
+                text: _('Cancel'),
+                iconCls: 'cancel',
+                handler: conf.cancel
+            });
+            buttons.push(cancelBtn);
+        }
+
         var saveBtn = new Ext.Button({
             text: _('Save'),
             iconCls: 'save',
@@ -941,15 +950,6 @@ tvheadend.idnode_editor = function(item, conf)
         });
         buttons.push(saveBtn);
 
-        if (conf.cancel) {
-            var cancelBtn = new Ext.Button({
-                text: _('Cancel'),
-                iconCls: 'cancel',
-                handler: conf.cancel
-            });
-            buttons.push(cancelBtn);
-        }
-
         if (conf.help) {
             var helpBtn = new Ext.Button({
                 text: _('Help'),
@@ -993,6 +993,7 @@ tvheadend.idnode_create = function(conf, onlyDefault)
 {
     var puuid = null;
     var panel = null;
+    var win   = null;
     var pclass = null;
 
     /* Buttons */
@@ -1079,6 +1080,7 @@ tvheadend.idnode_create = function(conf, onlyDefault)
                         panel.remove(s);
                         tvheadend.idnode_editor_form(d, null, panel, { create: true, showpwd: true });
                         saveBtn.setVisible(true);
+                        win.setOriginSize(true);
                     }
                 }
             };
@@ -1094,6 +1096,7 @@ tvheadend.idnode_create = function(conf, onlyDefault)
                         d = json_decode(d);
                         tvheadend.idnode_editor_form(d.props, d, panel, { create: true, showpwd: true });
                         saveBtn.setVisible(true);
+                        win.setOriginSize(true);
                     }
                 });
             };