diff options
Diffstat (limited to 'install/ui/src/freeipa/association.js')
-rw-r--r-- | install/ui/src/freeipa/association.js | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/install/ui/src/freeipa/association.js b/install/ui/src/freeipa/association.js index 25d5a0d87..2a1072149 100644 --- a/install/ui/src/freeipa/association.js +++ b/install/ui/src/freeipa/association.js @@ -493,30 +493,24 @@ IPA.association_table_widget = function (spec) { that.table_create(container); - that.remove_button = IPA.action_button({ + that.remove_button = IPA.button_widget({ name: 'remove', label: '@i18n:buttons.remove', icon: 'fa-trash-o', - 'class': 'action-button-disabled', - click: function() { - if (!that.remove_button.hasClass('action-button-disabled')) { - that.remove_handler(); - } - return false; - } - }).appendTo(that.buttons); + enabled: false, + button_class: 'btn btn-link', + click: that.remove_handler + }); + that.remove_button.create(that.buttons); - that.add_button = IPA.action_button({ + that.add_button = IPA.button_widget({ name: 'add', label: '@i18n:buttons.add', icon: 'fa-plus', - click: function() { - if (!that.add_button.hasClass('action-button-disabled')) { - that.add_handler(); - } - return false; - } - }).appendTo(that.buttons); + button_class: 'btn btn-link', + click: that.add_handler + }); + that.add_button.create(that.buttons); }; that.add_handler = function() { @@ -561,14 +555,13 @@ IPA.association_table_widget = function (spec) { that.set_enabled = function(enabled) { that.table_set_enabled(enabled); - if (enabled) { - if(that.add_button) { - that.add_button.removeClass('action-button-disabled'); - } - } else { - $('.action-button', that.table).addClass('action-button-disabled'); + if (!enabled) { that.unselect_all(); } + if (that.add_button) { + that.add_button.set_enabled(enabled); + that.remove_button.set_enabled(false); + } }; that.select_changed = function() { @@ -576,11 +569,7 @@ IPA.association_table_widget = function (spec) { var values = that.get_selected_values(); if (that.remove_button) { - if (values.length === 0) { - that.remove_button.addClass('action-button-disabled'); - } else { - that.remove_button.removeClass('action-button-disabled'); - } + that.remove_button.set_enabled(values.length > 0); } }; |