[pve-devel] [PATCH RFC manager v2 4/4] Replace nested ternary operators with if/else statements

Emmanuel Kasper e.kasper at proxmox.com
Thu Dec 22 12:15:23 CET 2016


---
 www/manager6/window/Edit.js | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/www/manager6/window/Edit.js b/www/manager6/window/Edit.js
index 36ef7b6..def5519 100644
--- a/www/manager6/window/Edit.js
+++ b/www/manager6/window/Edit.js
@@ -201,8 +201,21 @@ Ext.define('PVE.window.Edit', {
 
 	var form = me.formPanel.getForm();
 
+	var submitText;
+	if (me.create) {
+	    if (me.isAdd) {
+		submitText = gettext('Add');
+	    } else if (me.isRemove) {
+		submitText = gettext('Remove');
+	    } else {
+		submitText = gettext('Create');
+	    }
+	} else {
+	    submitText = gettext('OK');
+	}
+
 	var submitBtn = Ext.create('Ext.Button', {
-	    text: me.create ? (me.isAdd ? gettext('Add') : ( me.isRemove ? gettext('Remove') : gettext('Create'))) : gettext('OK'),
+	    text: submitText,
 	    disabled: !me.create,
 	    handler: function() {
 		me.submit();
-- 
2.1.4





More information about the pve-devel mailing list