From: Jaroslav Kysela Date: Sat, 21 Nov 2015 16:55:52 +0000 (+0100) Subject: WEBUI: grid add - fix dialog center X-Git-Tag: v4.2.1~1497 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=00ab0054ff1184330b5b0570e8a8b9c354b317f1;p=thirdparty%2Ftvheadend.git WEBUI: grid add - fix dialog center --- diff --git a/src/webui/static/app/extensions.js b/src/webui/static/app/extensions.js index 7abb95f11..1a58dbd34 100644 --- a/src/webui/static/app/extensions.js +++ b/src/webui/static/app/extensions.js @@ -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(); }, diff --git a/src/webui/static/app/idnode.js b/src/webui/static/app/idnode.js index 72d3f1a74..4259121af 100644 --- a/src/webui/static/app/idnode.js +++ b/src/webui/static/app/idnode.js @@ -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); } }); };