diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2012-06-27 18:15:11 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2012-06-29 11:56:04 +0200 |
commit | d46687ea91809b35b91d2127b3412679bedbcabc (patch) | |
tree | 119db6e3114b56785d874b192219c20039d1b51c /install/ui/facet.js | |
parent | 5b7084aeb587cd06dcfae8ab6fa3b175e6704138 (diff) | |
download | freeipa.git-d46687ea91809b35b91d2127b3412679bedbcabc.tar.gz freeipa.git-d46687ea91809b35b91d2127b3412679bedbcabc.tar.xz freeipa.git-d46687ea91809b35b91d2127b3412679bedbcabc.zip |
Refactored associatin facet to use facet buttons with actions
Association facet was refactored to use new concept of control buttons. It is the last facet type which don't use this concept.
It fixes regression introduced by previous refactoring of table facet (delete button was never enabled).
https://fedorahosted.org/freeipa/ticket/2876
Diffstat (limited to 'install/ui/facet.js')
-rw-r--r-- | install/ui/facet.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/install/ui/facet.js b/install/ui/facet.js index 550407bb..3f6d559e 100644 --- a/install/ui/facet.js +++ b/install/ui/facet.js @@ -1628,6 +1628,62 @@ IPA.self_service_state_evaluator = function(spec) { return that; }; +IPA.facet_attr_state_evaluator = function(spec) { + + spec = spec || {}; + + spec.event = spec.event || 'post_load'; + + var that = IPA.state_evaluator(spec); + that.name = spec.name || 'facet_attr_se'; + that.attribute = spec.attribute; + that.value = spec.value; + that.state_value = spec.state_value; + + that.on_event = function() { + + var old_state = that.state; + that.state = []; + + var facet = this; + + if (facet[that.attribute] === that.value) { + that.state.push(that.state_value); + } + + that.notify_on_change(old_state); + }; + + return that; +}; + +IPA.read_only_state_evaluator = function(spec) { + + spec = spec || {}; + + spec.name = spec.name || 'read_only_se'; + spec.attribute = spec.attribute || 'read_only'; + spec.state_value = spec.state_value || 'read-only'; + spec.value = spec.value !== undefined ? spec.value : true; + + var that = IPA.facet_attr_state_evaluator(spec); + return that; +}; + +IPA.association_type_state_evaluator = function(spec) { + + + spec = spec || {}; + + spec.name = spec.name || 'association_type_se'; + spec.attribute = spec.attribute || 'association_type'; + spec.state_value = spec.state_value || 'direct'; + spec.value = spec.value !== undefined ? spec.value : 'direct'; + + var that = IPA.facet_attr_state_evaluator(spec); + return that; +}; + IPA.action_button_widget = function(spec) { spec = spec || {}; |