From f99ab781ea33f0d7ca6df26090cd99f9315454ac Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Wed, 28 Sep 2011 15:56:25 -0500 Subject: 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 --- install/ui/add.js | 72 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 28 deletions(-) (limited to 'install/ui/add.js') diff --git a/install/ui/add.js b/install/ui/add.js index 21707df1..5a4537ba 100644 --- a/install/ui/add.js +++ b/install/ui/add.js @@ -111,40 +111,56 @@ IPA.add_dialog = function (spec) { }; /*dialog initialization*/ - that.add_button(IPA.messages.buttons.add, function() { - that.add( - function(data, text_status, xhr) { - var facet = IPA.current_entity.get_facet(); - var table = facet.table; - table.refresh(); - that.close(); - }, - that.on_error); + that.create_button({ + name: 'add', + label: IPA.messages.buttons.add, + click: function() { + that.add( + function(data, text_status, xhr) { + var facet = IPA.current_entity.get_facet(); + var table = facet.table; + table.refresh(); + that.close(); + }, + that.on_error); + } }); - that.add_button(IPA.messages.buttons.add_and_add_another, function() { - that.add( - function(data, text_status, xhr) { - var facet = IPA.current_entity.get_facet(); - var table = facet.table; - table.refresh(); - that.reset(); - }, - that.on_error); + that.create_button({ + name: 'add_and_add_another', + label: IPA.messages.buttons.add_and_add_another, + click: function() { + that.add( + function(data, text_status, xhr) { + var facet = IPA.current_entity.get_facet(); + var table = facet.table; + table.refresh(); + that.reset(); + }, + that.on_error); + } }); - that.add_button(IPA.messages.buttons.add_and_edit, function() { - that.add( - function(data, text_status, xhr) { - that.close(); - var result = data.result.result; - that.show_edit_page(that.entity, result); - }, - that.on_error); + that.create_button({ + name: 'add_and_edit', + label: IPA.messages.buttons.add_and_edit, + click: function() { + that.add( + function(data, text_status, xhr) { + that.close(); + var result = data.result.result; + that.show_edit_page(that.entity, result); + }, + that.on_error); + } }); - that.add_button(IPA.messages.buttons.cancel, function() { - that.close(); + that.create_button({ + name: 'cancel', + label: IPA.messages.buttons.cancel, + click: function() { + that.close(); + } }); return that; -- cgit