From 52208e8b40f98e7a7cc0c91b15803003740efa92 Mon Sep 17 00:00:00 2001 From: Petr Voborník Date: Wed, 22 Feb 2012 17:12:11 +0100 Subject: Moved is_empty method from field to IPA object is_empty method represents IPA UI standard of evaluating whether value is empty. Therefore is should be placed in IPA object instead of IPA.field to allow reuse in different locations. https://fedorahosted.org/freeipa/ticket/2351 --- install/ui/ipa.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'install/ui/ipa.js') diff --git a/install/ui/ipa.js b/install/ui/ipa.js index 433d7fe6..441e6468 100644 --- a/install/ui/ipa.js +++ b/install/ui/ipa.js @@ -1207,6 +1207,22 @@ IPA.create_options = function(labels, values) { return options; }; +IPA.is_empty = function(value) { + + var empty = false; + + if (!value) empty = true; + + if (value instanceof Array) { + empty = empty || value.length === 0 || + (value.length === 1) && (value[0] === ''); + } + + if (value === '') empty = true; + + return empty; +}; + IPA.config = { default_priority: 500 }; -- cgit