diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-02-23 12:35:45 -0600 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-03-02 12:26:24 -0500 |
commit | 697af3e1f8b4102df2bde5c7d04f8e7d4dad4369 (patch) | |
tree | 81ccaef5abec658748833695ee184a4f89fc2214 /install/ui/associate.js | |
parent | d37bb6f925cace69f15c8e548a69121bfb00be5e (diff) | |
download | freeipa.git-697af3e1f8b4102df2bde5c7d04f8e7d4dad4369.tar.gz freeipa.git-697af3e1f8b4102df2bde5c7d04f8e7d4dad4369.tar.xz freeipa.git-697af3e1f8b4102df2bde5c7d04f8e7d4dad4369.zip |
Save changes before modifying association.
In a details page, usually any changes done to the fields will not be
applied until the user clicks the Update button. However, if the page
contains an association table, any addition/deletion to the table will
be applied immediately.
To avoid any confusion, the user is now required to save or reset all
changes to the page before modifying the association. A dialog box will
appear if the page contains any unsaved changes.
Diffstat (limited to 'install/ui/associate.js')
-rw-r--r-- | install/ui/associate.js | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/install/ui/associate.js b/install/ui/associate.js index 600cd55c..2f1a28d5 100644 --- a/install/ui/associate.js +++ b/install/ui/associate.js @@ -351,6 +351,28 @@ IPA.association_table_widget = function (spec) { that.table_setup(container); + var dialog = $('<div/>', { + html: IPA.messages.dialogs.dirty_message + }).appendTo(container); + + var buttons = {}; + + buttons[IPA.messages.buttons.ok] = function() { + dialog.dialog('close'); + }; + + dialog.dialog({ + autoOpen: false, + title: IPA.messages.dialogs.dirty_title, + modal: true, + width: '20em', + buttons: buttons + }); + + var entity = IPA.get_entity(that.entity_name); + var facet_name = IPA.current_facet(entity); + var facet = entity.get_facet(facet_name); + var button = $('input[name=remove]', container); button.replaceWith(IPA.action_button({ 'label': button.val(), @@ -359,7 +381,13 @@ IPA.association_table_widget = function (spec) { if ($(this).hasClass('action-button-disabled')) { return false; } - that.show_remove_dialog(); + + if (facet.is_dirty()) { + dialog.dialog('open'); + } else { + that.show_remove_dialog(); + } + return false; } })); @@ -369,8 +397,16 @@ IPA.association_table_widget = function (spec) { 'label': button.val(), 'icon': 'ui-icon-plus', 'click': function() { - if ($(this).hasClass('action-button-disabled')) return false; - that.show_add_dialog(); + if ($(this).hasClass('action-button-disabled')) { + return false; + } + + if (facet.is_dirty()) { + dialog.dialog('open'); + } else { + that.show_add_dialog(); + } + return false; } })); |