webui: better check for existing options in attributes_widgets

https://fedorahosted.org/freeipa/ticket/4079

Reviewed-By: Adam Misnyovszki <amisnyov@redhat.com>
Reviewed-By: Petr Viktorin <pviktori@redhat.com>
This commit is contained in:
Petr Vobornik
2014-01-16 17:26:25 +01:00
parent 80324fcb23
commit c93dd068e4

View File

@@ -607,9 +607,7 @@ IPA.attributes_widget = function(spec) {
var unmatched = [];
for (var i=0; i<that.values.length; i++) {
var input = $('input[name="'+that.name+'"]'+
'[value="'+that.values[i]+'"]', that.container);
if (!input.length) {
if (!that.has_option(that.values[i])) {
unmatched.push(that.values[i]);
}
}
@@ -620,6 +618,14 @@ IPA.attributes_widget = function(spec) {
}
};
that.has_option = function(value) {
var o = that.options;
for (var i=0, l=o.length; i<l; i++) {
if (o[i].value === value) return true;
}
return false;
};
that.show_undo = function() {
$(that.undo_span).css('display', 'inline-block');
};