From eb87b8c31931e682cbb927896d1d60a0266e1263 Mon Sep 17 00:00:00 2001 From: Petr Voborník Date: Mon, 6 Feb 2012 14:52:09 +0100 Subject: UI support for ssh keys To user and host details pages was added ipasshpubkey attribute. New widget for ssh public keys was created. https://fedorahosted.org/freeipa/ticket/2340 --- install/ui/field.js | 95 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 79 insertions(+), 16 deletions(-) (limited to 'install/ui/field.js') diff --git a/install/ui/field.js b/install/ui/field.js index c79c59bb..46802be6 100644 --- a/install/ui/field.js +++ b/install/ui/field.js @@ -148,22 +148,28 @@ IPA.field = function(spec) { that.load = function(record) { that.record = record; - var value = record[that.name]; - if (value instanceof Array) { - that.values = value; - } else { - that.values = value !== undefined ? [value] : []; - } - - if (!that.values.length) { - that.values = ['']; - } + that.values = that.get_value(record, that.name); that.load_writable(record); that.reset(); }; + that.get_value = function(record, name) { + + var value = record[name]; + + if (!(value instanceof Array)) { + value = value !== undefined ? [value] : []; + } + + if (!value.length) { + value = ['']; + } + + return value; + }; + that.load_writable = function(record) { that.writable = true; @@ -272,16 +278,21 @@ IPA.field = function(spec) { //compare values in array if (values.length !== that.values.length) return true; - values.sort(); - that.values.sort(); + return !that.dirty_are_equal(that.values, values); + }; - for (var i=0; i