summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2012-09-13 11:24:41 +0200
committerPetr Vobornik <pvoborni@redhat.com>2013-01-07 10:53:58 +0100
commitb33f6acfa87587f30822680abe8721f376737022 (patch)
tree6e250a145f8232a7a847bb600a0747d5707d7339 /install
parentc23dd23219d224de8844df07f7cf6564f8abc98f (diff)
downloadfreeipa-b33f6acfa87587f30822680abe8721f376737022.tar.gz
freeipa-b33f6acfa87587f30822680abe8721f376737022.tar.xz
freeipa-b33f6acfa87587f30822680abe8721f376737022.zip
Make confirm_dialog a base class for message_dialog
https://fedorahosted.org/freeipa/ticket/3035
Diffstat (limited to 'install')
-rw-r--r--install/ui/dialog.js37
-rw-r--r--install/ui/dns.js14
2 files changed, 21 insertions, 30 deletions
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index 172c4478d..d84f947e1 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -636,26 +636,15 @@ IPA.message_dialog = function(spec) {
spec.name = spec.name || 'message_dialog';
- var that = IPA.dialog(spec);
- that.message = spec.message || '';
- that.on_ok = spec.on_ok;
+ var that = IPA.confirm_dialog(spec);
- that.create = function() {
- $('<p/>', {
- 'text': that.message
- }).appendTo(that.container);
+ that.open = function(container) {
+
+ that.confirm_dialog_open(container);
+ that.confirmed = true; // there are no options to confirm
};
- that.create_button({
- name: 'ok',
- label: IPA.messages.buttons.ok,
- click: function() {
- that.close();
- if (that.on_ok) {
- that.on_ok();
- }
- }
- });
+ that.buttons.remove('cancel');
that.message_dialog_create = that.create;
@@ -665,16 +654,24 @@ IPA.message_dialog = function(spec) {
IPA.confirm_dialog = function(spec) {
spec = spec || {};
- spec.message = spec.message || IPA.messages.actions.confirm;
+ spec.name = spec.name || 'confirm_dialog';
spec.title = spec.title || IPA.messages.dialogs.confirmation;
- var that = IPA.message_dialog(spec);
+ var that = IPA.dialog(spec);
+ that.message = spec.message || '';
+ that.on_ok = spec.on_ok;
that.on_cancel = spec.on_cancel;
that.ok_label = spec.ok_label || IPA.messages.buttons.ok;
that.cancel_label = spec.cancel_label || IPA.messages.buttons.cancel;
that.confirmed = false;
that.confirm_on_enter = spec.confirm_on_enter !== undefined ? spec.confirm_on_enter : true;
+ that.create = function() {
+ $('<p/>', {
+ 'text': that.message
+ }).appendTo(that.container);
+ };
+
that.close = function() {
that.dialog_close();
@@ -709,8 +706,6 @@ IPA.confirm_dialog = function(spec) {
that.create_buttons = function() {
- that.buttons.empty();
-
that.create_button({
name: 'ok',
label: that.ok_label,
diff --git a/install/ui/dns.js b/install/ui/dns.js
index fceb3e74f..d08f4140b 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -1258,7 +1258,7 @@ IPA.dnsrecord_redirection_dialog = function(spec) {
spec = spec || {};
spec.title = spec.title || IPA.messages.dialogs.redirection;
- var that = IPA.dialog(spec);
+ var that = IPA.message_dialog(spec);
that.create = function() {
$('<p/>', {
@@ -1269,14 +1269,10 @@ IPA.dnsrecord_redirection_dialog = function(spec) {
}).appendTo(that.container);
};
- that.create_button({
- name: 'ok',
- label: IPA.messages.buttons.ok,
- click: function() {
- that.close();
- IPA.nav.show_page('dnszone','default');
- }
- });
+ that.on_ok = function() {
+ IPA.nav.show_page('dnszone','default');
+ };
+
return that;
};