From c23dd23219d224de8844df07f7cf6564f8abc98f Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 13 Sep 2012 11:23:35 +0200 Subject: Make confirm_dialog a base class for deleter dialog https://fedorahosted.org/freeipa/ticket/3035 --- install/ui/dialog.js | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) (limited to 'install/ui/dialog.js') 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() { $('

', { - 'text': IPA.messages.search.delete_confirm + 'text': that.message }).appendTo(that.container); var 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; -- cgit