diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2012-09-13 11:23:35 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-02-21 13:02:32 +0100 |
commit | 92aa635be56fe6e991e902ece369a7bbf57a018d (patch) | |
tree | af2690fe33ec648a495cda7ed9a24c9f63619dd9 | |
parent | 9806eae286764e35a218d9e3f832a6c85a7ca929 (diff) | |
download | freeipa.git-92aa635be56fe6e991e902ece369a7bbf57a018d.tar.gz freeipa.git-92aa635be56fe6e991e902ece369a7bbf57a018d.tar.xz freeipa.git-92aa635be56fe6e991e902ece369a7bbf57a018d.zip |
Make confirm_dialog a base class for deleter dialog
https://fedorahosted.org/freeipa/ticket/3035
-rw-r--r-- | install/ui/association.js | 6 | ||||
-rw-r--r-- | install/ui/dialog.js | 38 | ||||
-rw-r--r-- | install/ui/dns.js | 2 | ||||
-rw-r--r-- | install/ui/search.js | 2 | ||||
-rw-r--r-- | install/ui/sudo.js | 2 | ||||
-rw-r--r-- | install/ui/widget.js | 2 |
6 files changed, 9 insertions, 43 deletions
diff --git a/install/ui/association.js b/install/ui/association.js index edba681f..70b8e9f1 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -632,12 +632,10 @@ IPA.association_table_widget = function (spec) { selected_values, function() { that.refresh(); - dialog.close(); IPA.notify_success(IPA.messages.association.removed); }, function() { that.refresh(); - dialog.close(); } ); }; @@ -1051,12 +1049,10 @@ IPA.association_facet = function (spec, no_init) { method: that.remove_method, on_success: function() { that.refresh(); - dialog.close(); IPA.notify_success(IPA.messages.association.removed); }, on_error: function() { that.refresh(); - dialog.close(); } }); @@ -1311,12 +1307,10 @@ IPA.attribute_facet = function(spec, no_init) { function(data) { that.load(data); that.show_content(); - dialog.close(); IPA.notify_success(IPA.messages.association.removed); }, function() { that.refresh(); - dialog.close(); } ); }; diff --git a/install/ui/dialog.js b/install/ui/dialog.js index e3d3395f..172c4478 100644 --- a/install/ui/dialog.js +++ b/install/ui/dialog.js @@ -569,13 +569,17 @@ IPA.adder_dialog = function(spec) { IPA.deleter_dialog = function (spec) { spec = spec || {}; - spec.name = spec.name || 'deleter_dialog'; - - var that = IPA.dialog(spec); - that.title = spec.title || IPA.messages.buttons.remove; + spec.title = spec.title || IPA.messages.buttons.remove; + spec.name = spec.name || 'deleter_dialog'; + spec.message = spec.message || IPA.messages.search.delete_confirm; + spec.ok_label = spec.ok_label || IPA.messages.buttons.remove; + var that = IPA.confirm_dialog(spec); that.values = spec.values || []; + that.on_ok = spec.on_ok || function() { + that.execute(); + }; that.add_value = function(value) { that.values.push(value); @@ -588,7 +592,7 @@ IPA.deleter_dialog = function (spec) { that.create = function() { $('<p/>', { - 'text': IPA.messages.search.delete_confirm + 'text': that.message }).appendTo(that.container); var div = $('<div/>', { @@ -621,30 +625,6 @@ IPA.deleter_dialog = function (spec) { } }; - that.open = function(container) { - - that.create_button({ - name: 'remove', - label: IPA.messages.buttons.remove, - click: function() { - that.execute(); - } - }); - - that.create_button({ - name: 'cancel', - label: IPA.messages.buttons.cancel, - click: function() { - that.close(); - } - }); - - that.dialog_open(container); - }; - - that.execute = function() { - }; - that.deleter_dialog_create = that.create; return that; diff --git a/install/ui/dns.js b/install/ui/dns.js index fd6127d3..fceb3e74 100644 --- a/install/ui/dns.js +++ b/install/ui/dns.js @@ -1816,13 +1816,11 @@ IPA.dns.record_type_table_widget = function(spec) { that.idnsname[0], function(data) { that.reload_facet(data); - dialog.close(); that.notify_facet_update(); that.facet.nofify_update_success(); }, function() { that.refresh_facet(); - dialog.close(); } ); }; diff --git a/install/ui/search.js b/install/ui/search.js index 7c4939bb..28723d3e 100644 --- a/install/ui/search.js +++ b/install/ui/search.js @@ -311,13 +311,11 @@ IPA.search_deleter_dialog = function(spec) { batch.on_success = function(data, text_status, xhr) { that.facet.refresh(); that.facet.on_update.notify([],that.facet); - that.close(); IPA.notify_success(IPA.messages.search.deleted); }; batch.on_error = function() { that.facet.refresh(); - that.close(); }; batch.execute(); diff --git a/install/ui/sudo.js b/install/ui/sudo.js index ce020b6a..fddcda0b 100644 --- a/install/ui/sudo.js +++ b/install/ui/sudo.js @@ -881,12 +881,10 @@ IPA.sudo.options_section = function(spec) { that.reload(); } - dialog.close(); IPA.notify_success(IPA.messages.objects.sudorule.option_removed); }, on_error: function(data) { that.reload(); - dialog.close(); } }); diff --git a/install/ui/widget.js b/install/ui/widget.js index 2f12ad84..8d2239d8 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -1903,12 +1903,10 @@ IPA.attribute_table_widget = function(spec) { function(data, text_status, xhr) { var handler = that.on_remove || that.on_command_success; handler.call(this, data, text_status, xhr); - dialog.close(); }, function(xhr, text_status, error_thrown) { var handler = that.on_remove_error || that.on_command_error; handler.call(this, xhr, text_status, error_thrown); - dialog.close(); } ); command.execute(); |