From aa29a8a769c62b07cc4e6d82fc79846505cc9fa3 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Thu, 26 May 2011 17:57:39 -0500 Subject: Added Update and Reset buttons into Dirty dialog. The Dirty dialogs have been combined into IPA.dirty_dialog. It provides the Update and Reset buttons with customizable callback. Previously the widget's dirty status is computed by comparing the old values with the new values. This method is sometimes inaccurate, so the is_dirty() method has been modified to simply return a flag which is set to true if the widget is changed. Ticket #896. --- install/ui/associate.js | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'install/ui/associate.js') diff --git a/install/ui/associate.js b/install/ui/associate.js index 3ba510f1..5eb84260 100644 --- a/install/ui/associate.js +++ b/install/ui/associate.js @@ -348,7 +348,6 @@ IPA.association_table_widget = function (spec) { that.create = function(container) { - var entity = IPA.get_entity(that.entity_name); var column; // create a column if none defined @@ -395,21 +394,6 @@ IPA.association_table_widget = function (spec) { that.table_setup(container); - var dialog = IPA.dialog({ - title: IPA.messages.dialogs.dirty_title, - width: '20em' - }); - - dialog.create = function() { - dialog.container.append(IPA.messages.dialogs.dirty_message); - }; - - dialog.add_button(IPA.messages.buttons.ok, function() { - dialog.close(); - }); - - dialog.init(); - var entity = IPA.get_entity(that.entity_name); var facet_name = IPA.current_facet(entity); var facet = entity.get_facet(facet_name); @@ -424,7 +408,17 @@ IPA.association_table_widget = function (spec) { } if (facet.is_dirty()) { + var dialog = IPA.dirty_dialog({ + facet: facet + }); + + dialog.callback = function() { + that.show_remove_dialog(); + }; + + dialog.init(); dialog.open(that.container); + } else { that.show_remove_dialog(); } @@ -443,7 +437,17 @@ IPA.association_table_widget = function (spec) { } if (facet.is_dirty()) { + var dialog = IPA.dirty_dialog({ + facet: facet + }); + + dialog.callback = function() { + that.show_add_dialog(); + }; + + dialog.init(); dialog.open(that.container); + } else { that.show_add_dialog(); } @@ -809,11 +813,6 @@ IPA.association_facet = function (spec) { that.table.init(); }; - that.is_dirty = function() { - var pkey = $.bbq.getState(that.entity_name+'-pkey'); - return pkey != that.pkey; - }; - that.create_header = function(container) { that.facet_create_header(container); -- cgit