diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-09-28 15:56:25 -0500 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2011-09-29 16:57:19 +0000 |
commit | f99ab781ea33f0d7ca6df26090cd99f9315454ac (patch) | |
tree | 548558b589a656503eeb50aa090eed3a45b6f8e4 /install/ui/user.js | |
parent | ecb58275e30f215143c57bdf96094103c8fda7ba (diff) | |
download | freeipa.git-f99ab781ea33f0d7ca6df26090cd99f9315454ac.tar.gz freeipa.git-f99ab781ea33f0d7ca6df26090cd99f9315454ac.tar.xz freeipa.git-f99ab781ea33f0d7ca6df26090cd99f9315454ac.zip |
Disable enroll button if nothing selected.
A new IPA.dialog_button class has been added to encapsulate the
buttons in the dialog box so they can be managed more easily.
The adder dialog has been modified to disable the enroll button if
there is no entries selected.
Ticket #1856
Diffstat (limited to 'install/ui/user.js')
-rw-r--r-- | install/ui/user.js | 80 |
1 files changed, 48 insertions, 32 deletions
diff --git a/install/ui/user.js b/install/ui/user.js index 62794ad7..60958cb4 100644 --- a/install/ui/user.js +++ b/install/ui/user.js @@ -261,19 +261,27 @@ IPA.user_status_widget = function(spec) { dialog.container.append(message); }; - dialog.add_button(action_label, function() { - that.set_status( - action == 'activate', - function(data, textStatus, xhr) { - var facet = that.entity.get_facet(); - facet.refresh(); - dialog.close(); - } - ); + dialog.create_button({ + name: 'set_status', + label: action_label, + click: function() { + that.set_status( + action == 'activate', + function(data, textStatus, xhr) { + var facet = that.entity.get_facet(); + facet.refresh(); + dialog.close(); + } + ); + } }); - dialog.add_button(IPA.messages.buttons.cancel, function() { - dialog.close(); + dialog.create_button({ + name: 'cancel', + label: IPA.messages.buttons.cancel, + click: function() { + dialog.close(); + } }); dialog.open(that.container); @@ -334,33 +342,41 @@ IPA.user_password_widget = function(spec) { type: 'password' })); - dialog.add_button(IPA.messages.password.reset_password, function() { - - var record = {}; - dialog.save(record); + dialog.create_button({ + name: 'reset_password', + label: IPA.messages.password.reset_password, + click: function() { - var new_password = record.password1[0]; - var repeat_password = record.password2[0]; + var record = {}; + dialog.save(record); - if (new_password != repeat_password) { - alert(IPA.messages.password.password_must_match); - return; - } + var new_password = record.password1[0]; + var repeat_password = record.password2[0]; - that.set_password( - new_password, - function(data, text_status, xhr) { - alert(IPA.messages.password.password_change_complete); - dialog.close(); - }, - function(xhr, text_status, error_thrown) { - dialog.close(); + if (new_password != repeat_password) { + alert(IPA.messages.password.password_must_match); + return; } - ); + + that.set_password( + new_password, + function(data, text_status, xhr) { + alert(IPA.messages.password.password_change_complete); + dialog.close(); + }, + function(xhr, text_status, error_thrown) { + dialog.close(); + } + ); + } }); - dialog.add_button(IPA.messages.buttons.cancel, function() { - dialog.close(); + dialog.create_button({ + name: 'cancel', + label: IPA.messages.buttons.cancel, + click: function() { + dialog.close(); + } }); dialog.open(that.container); |