The optional uid field in user's adder dialog did not appear when
the link is clicked to show the field. This is a regression introduced
in the patch for ticket #1648.

The click handler for the link field has been moved into a new closure
so that the variables point to the correct elements.

Note: the duplicate code in IPA.details_table_section.create() and
IPA.dialog.create() will be addressed separately in ticket #1394.

--
Endi S. Dewata
From c2a90c8cd76f0aecf7593cdf438fecda6c21ccef Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Fri, 9 Sep 2011 18:32:37 -0500
Subject: [PATCH] Fixed missing optional field.

The optional uid field in user's adder dialog did not appear when
the link is clicked to show the field. This is a regression introduced
in the patch for ticket #1648.

The click handler for the link field has been moved into a new closure
so that the variables point to the correct elements.

Note: the duplicate code in IPA.details_table_section.create() and
IPA.dialog.create() will be addressed separately in ticket #1394.
---
 install/ui/details.js |   14 +++++++++-----
 install/ui/dialog.js  |   16 ++++++++++------
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/install/ui/details.js b/install/ui/details.js
index 23f217afb161c5a21ac6f11e01c80c74203672d1..f7831114d1fdda76c6c1d0276fd5f2c07051616e 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -213,17 +213,21 @@ IPA.details_table_section = function(spec) {
 
             field.create(field_container);
 
-            if (field.optional){
+            if (field.optional) {
                 field_container.css('display', 'none');
+
                 var link = $('<a/>', {
                     text: IPA.messages.widget.optional,
-                    href: '',
-                    click: function() {
+                    href: ''
+                }).appendTo(td);
+
+                link.click(function(field_container, link) {
+                    return function() {
                         field_container.css('display', 'inline');
                         link.css('display', 'none');
                         return false;
-                    }
-                }).appendTo(td);
+                    };
+                }(field_container, link));
             }
         }
     };
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index 2d6d941c6379c0ac6b61eef852ea5b3bd58240c3..86aefeffc06c7e2404a9ec9bc15ea9d8a949c278 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -162,17 +162,21 @@ IPA.dialog = function(spec) {
 
             field.create(field_container);
 
-            if (field.optional){
-                field_container.css('display','none');
+            if (field.optional) {
+                field_container.css('display', 'none');
+
                 var link = $('<a/>', {
                     text: IPA.messages.widget.optional,
-                    href: '',
-                    click: function(){
+                    href: ''
+                }).appendTo(td);
+
+                link.click(function(field_container, link) {
+                    return function() {
                         field_container.css('display', 'inline');
                         link.css('display', 'none');
                         return false;
-                    }
-                }).appendTo(td);
+                    };
+                }(field_container, link));
             }
 
         }
-- 
1.7.5.1

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

Reply via email to