[Freeipa-devel] [PATCH] 167 Added Update and Reset buttons into Dirty dialog.

2011-05-27 Thread Endi Sukma Dewata

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.

--
Endi S. Dewata
From 826122a193737641e24b6bcd1ff2ba3e21353aba Mon Sep 17 00:00:00 2001
From: Endi S. Dewata edew...@redhat.com
Date: Thu, 26 May 2011 17:57:39 -0500
Subject: [PATCH] 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/aci.js   |7 +-
 install/ui/associate.js |   41 ++--
 install/ui/details.js   |8 +--
 install/ui/dns.js   |6 --
 install/ui/entity.js|5 +-
 install/ui/hbac.js  |5 +-
 install/ui/ipa.js   |   68 +++-
 install/ui/navigation.js|   22 ++-
 install/ui/sudo.js  |3 +-
 install/ui/test/widget_tests.js |9 ++-
 install/ui/widget.js|  134 +++
 11 files changed, 142 insertions(+), 166 deletions(-)

diff --git a/install/ui/aci.js b/install/ui/aci.js
index 336a965fc5d236c91802e9abae019d0b5eea6c1b..d507e2d07b85809d1e45bddbbe6cc3f59faffd02 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -233,7 +233,7 @@ IPA.attributes_widget = function(spec) {
 click: function(){
 $('.aci-attribute', that.table).
 attr('checked', $(this).attr('checked'));
-that.show_undo();
+that.set_dirty(true);
 }
 })
 })).append($('th/', {
@@ -245,7 +245,6 @@ IPA.attributes_widget = function(spec) {
 that.create_undo(container);
 that.get_undo().click(function(){
 that.reset();
-that.hide_undo();
 });
 }
 
@@ -298,7 +297,7 @@ IPA.attributes_widget = function(spec) {
 value: value,
 'class': 'aci-attribute',
 click: function() {
-that.show_undo();
+that.set_dirty(true);
 }
 }));
 td =  $('td/').appendTo(aci_tr);
@@ -335,7 +334,7 @@ IPA.attributes_widget = function(spec) {
 value: value,
 'class': 'aci-attribute',
 change: function() {
-that.show_undo();
+that.set_dirty(true);
 }
 }));
 
diff --git a/install/ui/associate.js b/install/ui/associate.js
index 3ba510f10caf502cfa3323137b6a4eba27afbc72..5eb84260eee57ef556db13cf4e04eeb9c430f52a 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

Re: [Freeipa-devel] [PATCH] 167 Added Update and Reset buttons into Dirty dialog.

2011-05-27 Thread Adam Young

On 05/27/2011 12:43 PM, Endi Sukma Dewata wrote:

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.


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

ACK.  Pushed to master
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel