diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 850772754..d42b2008d 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -219,6 +219,10 @@ IPA.input_widget = function(spec) { that.value_changed.notify([value], that); }; + that.is_writable = function() { + return !that.read_only && !!that.writable; + }; + that.focus_input = function() {}; that.set_deleted = function() {}; @@ -293,11 +297,10 @@ IPA.text_widget = function(spec) { that.update = function(values) { var value = values && values.length ? values[0] : ''; - if (that.read_only || !that.writable) { + if (!that.is_writable()) { that.display_control.text(value); that.display_control.css('display', 'inline'); that.input.css('display', 'none'); - } else { that.input.val(value); that.display_control.css('display', 'none'); @@ -308,9 +311,8 @@ IPA.text_widget = function(spec) { }; that.save = function() { - if (that.read_only || !that.writable) { + if (!that.is_writable()) { return null; - } else { var value = that.input.val(); return value === '' ? [] : [value]; @@ -395,7 +397,9 @@ IPA.multivalued_widget = function(spec) { for(var i=0; i