[Rt-commit] rt branch, 4.0/rights-editor-autocomplete-behaviour, created. rt-4.0.0rc6-100-g5b4ce98

Thomas Sibley trs at bestpractical.com
Thu Mar 17 12:20:58 EDT 2011


The branch, 4.0/rights-editor-autocomplete-behaviour has been created
        at  5b4ce986c3d324a8178013af206b77198099baf5 (commit)

- Log -----------------------------------------------------------------
commit 5b4ce986c3d324a8178013af206b77198099baf5
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Mar 17 12:19:24 2011 -0400

    Make sure we update the pane title right away when clicking an autocomplete option
    
    The previous behaviour, which didn't update the pane title until after
    you blurred the input box, was confusing users.  They thought their
    group/user wasn't getting selected.

diff --git a/share/html/NoAuth/js/util.js b/share/html/NoAuth/js/util.js
index de2e6e3..bf75734 100644
--- a/share/html/NoAuth/js/util.js
+++ b/share/html/NoAuth/js/util.js
@@ -294,7 +294,7 @@ function ReplaceAllTextareas(encoded) {
     }
 };
 
-function toggle_addprincipal_validity(input, good) {
+function toggle_addprincipal_validity(input, good, title) {
     if (good) {
         jQuery(input).nextAll(".warning").hide();
         jQuery("#acl-AddPrincipal input[type=checkbox]").removeAttr("disabled");
@@ -302,17 +302,23 @@ function toggle_addprincipal_validity(input, good) {
         jQuery(input).nextAll(".warning").css("display", "block");
         jQuery("#acl-AddPrincipal input[type=checkbox]").attr("disabled", "disabled");
     }
-    update_addprincipal_title(input);
+
+    if (title == null)
+        title = jQuery(input).val();
+
+    update_addprincipal_title( title );
 }
 
-function update_addprincipal_title(input) {
+function update_addprincipal_title(title) {
     var h3 = jQuery("#acl-AddPrincipal h3");
-    h3.html( h3.text().replace(/: .*$/,'') + ": " + jQuery(input).val() );
+    h3.html( h3.text().replace(/: .*$/,'') + ": " + title );
 }
 
 // when a value is selected from the autocompleter
-function addprincipal_onselect() {
-    toggle_addprincipal_validity(this, true);
+function addprincipal_onselect(ev, ui) {
+    // pass the item's value along as the title since the input's value
+    // isn't actually updated yet
+    toggle_addprincipal_validity(this, true, ui.item.value);
 }
 
 // when the input is actually changed, through typing or autocomplete

-----------------------------------------------------------------------


More information about the Rt-commit mailing list