diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-05-26 17:57:39 -0500 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-05-27 13:06:57 -0400 |
commit | aa29a8a769c62b07cc4e6d82fc79846505cc9fa3 (patch) | |
tree | 2131098b113c2bfecf1830feff0c08b3b2d1aabc /install/ui/ipa.js | |
parent | 17c3f9e84efcbeb3b5ae1de83d799974de3bb078 (diff) | |
download | freeipa-aa29a8a769c62b07cc4e6d82fc79846505cc9fa3.tar.gz freeipa-aa29a8a769c62b07cc4e6d82fc79846505cc9fa3.tar.xz freeipa-aa29a8a769c62b07cc4e6d82fc79846505cc9fa3.zip |
Added Update and Reset buttons into Dirty dialog.
The Dirty dialogs have been combined into IPA.dirty_dialog. It
provides the Update and Reset buttons with customizable callback.
Previously the widget's dirty status is computed by comparing the
old values with the new values. This method is sometimes inaccurate,
so the is_dirty() method has been modified to simply return a flag
which is set to true if the widget is changed.
Ticket #896.
Diffstat (limited to 'install/ui/ipa.js')
-rw-r--r-- | install/ui/ipa.js | 68 |
1 files changed, 37 insertions, 31 deletions
diff --git a/install/ui/ipa.js b/install/ui/ipa.js index 0266e3499..7fd784b54 100644 --- a/install/ui/ipa.js +++ b/install/ui/ipa.js @@ -155,37 +155,6 @@ var IPA = ( function () { that.entities.remove(name); }; - that.test_dirty = function(){ - if (IPA.current_entity){ - var facet_name = IPA.current_facet(IPA.current_entity); - var facet = IPA.current_entity.get_facet(facet_name); - if (!facet) return false; - - if (facet.is_dirty()){ - - var dialog = IPA.dialog({ - title: IPA.messages.dialogs.dirty_title, - width: '20em' - }); - - dialog.create = function() { - dialog.container.append(IPA.messages.dialogs.dirty_message); - }; - - dialog.add_button(IPA.messages.buttons.ok, function() { - dialog.close(); - }); - - dialog.init(); - - dialog.open($('#navigation')); - - return false; - } - } - return true; - }; - that.display_activity_icon = function() { that.network_call_count++; $('.network-activity-indicator').css('visibility', 'visible'); @@ -578,3 +547,40 @@ IPA.create_network_spinner = function(){ 'class':'network-activity-indicator', html: '<img src="spinner_small.gif" />'}); }; + +IPA.dirty_dialog = function(spec) { + + spec = spec || {}; + spec.title = spec.title || IPA.messages.dialogs.dirty_title; + spec.width = spec.width || '25em'; + + var that = IPA.dialog(spec); + that.facet = spec.facet; + that.message = spec.message || IPA.messages.dialogs.dirty_message; + + that.create = function() { + that.container.append(that.message); + }; + + that.add_button(IPA.messages.buttons.update, function() { + that.facet.update(function() { + that.close(); + that.callback(); + }); + }); + + that.add_button(IPA.messages.buttons.reset, function() { + that.facet.reset(); + that.close(); + that.callback(); + }); + + that.add_button(IPA.messages.buttons.cancel, function() { + that.close(); + }); + + that.callback = function() { + }; + + return that; +};
\ No newline at end of file |