summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2012-10-25 10:27:47 +0200
committerPetr Vobornik <pvoborni@redhat.com>2013-01-07 10:53:58 +0100
commitd14f76ef14b337ddcf77dfecb9dc3d8c34cbc7d4 (patch)
tree54ac82e9a7e1506c0a8ee4712d89c512e4b9b6f6
parent5bde2704364d246f021b3c9f03ba0bb1ee4b8b1c (diff)
downloadfreeipa-d14f76ef14b337ddcf77dfecb9dc3d8c34cbc7d4.tar.gz
freeipa-d14f76ef14b337ddcf77dfecb9dc3d8c34cbc7d4.tar.xz
freeipa-d14f76ef14b337ddcf77dfecb9dc3d8c34cbc7d4.zip
Confirm adder dialog by enter
Added confirm mixin support to entity adder dialog. https://fedorahosted.org/freeipa/ticket/3200
-rw-r--r--install/ui/add.js31
1 files changed, 21 insertions, 10 deletions
diff --git a/install/ui/add.js b/install/ui/add.js
index a5e30092f..2fd50ee63 100644
--- a/install/ui/add.js
+++ b/install/ui/add.js
@@ -31,6 +31,8 @@ IPA.entity_adder_dialog = function(spec) {
var that = IPA.dialog(spec);
+ IPA.confirm_mixin().apply(that);
+
that.method = spec.method || 'add';
that.on_error = spec.on_error ;
that.retry = typeof spec.retry !== 'undefined' ? spec.retry : true;
@@ -45,16 +47,7 @@ IPA.entity_adder_dialog = function(spec) {
name: 'add',
label: IPA.messages.buttons.add,
click: function() {
- that.hide_message();
- that.add(
- function(data, text_status, xhr) {
- that.added.notify();
- var facet = IPA.current_entity.get_facet();
- facet.refresh();
- that.close();
- that.notify_success(data);
- },
- that.on_error);
+ that.on_add();
}
});
@@ -102,6 +95,24 @@ IPA.entity_adder_dialog = function(spec) {
});
};
+ that.on_add = function() {
+
+ that.hide_message();
+ that.add(
+ function(data, text_status, xhr) {
+ that.added.notify();
+ var facet = IPA.current_entity.get_facet();
+ facet.refresh();
+ that.close();
+ that.notify_success(data);
+ },
+ that.on_error);
+ };
+
+ that.on_confirm = function() {
+ that.on_add();
+ };
+
that.get_success_message = function(data) {
var message = IPA.messages.dialogs.add_confirmation;
return message.replace('${entity}', that.subject);