[Rt-commit] rt branch, 4.2/autocomplete-email-input, created. rt-4.1.8-573-ga86080d

? sunnavy sunnavy at bestpractical.com
Fri Jun 14 08:57:52 EDT 2013


The branch, 4.2/autocomplete-email-input has been created
        at  a86080de54858ecc7f9c571bcd4f65e66452e6ae (commit)

- Log -----------------------------------------------------------------
commit 88fe728cebce460fda9520cccf3ebf4af682e135
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jun 12 21:14:08 2013 +0800

    new way to autocomplete users/groups by "data-autocomplete" attribute
    
    this doesn't affect autocomplete inputs in old ways(by names), but it's good
    if we can migrate them.

diff --git a/share/static/js/userautocomplete.js b/share/static/js/userautocomplete.js
index a6ae742..bd39605 100644
--- a/share/static/js/userautocomplete.js
+++ b/share/static/js/userautocomplete.js
@@ -76,4 +76,19 @@ jQuery(function() {
                     .appendTo( ul );
             };
     }
+
+    jQuery("input[data-autocomplete]:not(.ui-autocomplete-input)").each(function(){
+        var input = jQuery(this);
+        var what  = input.attr("data-autocomplete");
+        var wants = input.attr("data-autocomplete-return");
+
+        if (!what || !what.match(/^(Users|Groups)$/))
+            return;
+
+        input.autocomplete({
+            source: RT.Config.WebPath + "/Helpers/Autocomplete/" + what
+                    + (wants ? "?return=" + wants : "")
+        });
+    });
+
 });

commit a86080de54858ecc7f9c571bcd4f65e66452e6ae
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Jun 11 20:16:38 2013 +0800

    Autocomplete support for /Elements/EmailInput

diff --git a/share/html/Elements/EmailInput b/share/html/Elements/EmailInput
index 2830a72..7d79b2b 100644
--- a/share/html/Elements/EmailInput
+++ b/share/html/Elements/EmailInput
@@ -45,9 +45,10 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<input type="text" id="<% $Name %>" name="<% $Name %>" <% defined $Size ? qq{size="$Size"} : '' |n %> value="<% $Default || '' %>" />
+<input type="text" id="<% $Name %>" name="<% $Name %>" <% defined $Size ? qq{size="$Size"} : '' |n %> value="<% $Default || '' %>" <% $Autocomplete ? q{data-autocomplete="Users"} : '' |n%> />
 <%ARGS>
 $Name
 $Size    => 40
 $Default => ''
+$Autocomplete => 1
 </%ARGS>

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


More information about the Rt-commit mailing list