diff options
author | Petr VobornÃk <pvoborni@redhat.com> | 2012-02-22 17:12:11 +0100 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2012-02-29 12:59:13 +0100 |
commit | 52208e8b40f98e7a7cc0c91b15803003740efa92 (patch) | |
tree | bf513a356f7f440bfb5c9cf12303a974b0a405af /install/ui/ipa.js | |
parent | 25bda1e860a55faa7975cf37b69a74f2c138d309 (diff) | |
download | freeipa-52208e8b40f98e7a7cc0c91b15803003740efa92.tar.gz freeipa-52208e8b40f98e7a7cc0c91b15803003740efa92.tar.xz freeipa-52208e8b40f98e7a7cc0c91b15803003740efa92.zip |
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
Diffstat (limited to 'install/ui/ipa.js')
-rw-r--r-- | install/ui/ipa.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/install/ui/ipa.js b/install/ui/ipa.js index 433d7fe6d..441e6468d 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 }; |