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

Emmanuel Kasper e.kasper at proxmox.com
Tue Dec 20 11:27:47 CET 2016


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

diff --git a/www/manager6/window/Edit.js b/www/manager6/window/Edit.js
index c29b97b..f990865 100644
--- a/www/manager6/window/Edit.js
+++ b/www/manager6/window/Edit.js
@@ -201,8 +201,24 @@ 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