diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2012-10-25 10:27:47 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-02-21 13:03:12 +0100 |
commit | 40a5d90cfe2077d847841ce46a859ca9ade97a61 (patch) | |
tree | 4eefe8a81e37faf29aab5f15f1b2386deb27d364 | |
parent | c3de70c77bae2b184b52b6029c4146b8312be784 (diff) | |
download | freeipa.git-40a5d90cfe2077d847841ce46a859ca9ade97a61.tar.gz freeipa.git-40a5d90cfe2077d847841ce46a859ca9ade97a61.tar.xz freeipa.git-40a5d90cfe2077d847841ce46a859ca9ade97a61.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.js | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/install/ui/add.js b/install/ui/add.js index a5e30092..2fd50ee6 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); |