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

? sunnavy sunnavy at bestpractical.com
Wed Jun 12 09:23:11 EDT 2013


The branch, 4.2/autocomplete-email-input has been updated
       via  71773b0b419abddd1146c672957a84d836f04ea6 (commit)
      from  e1ec7ad55cfe1504cf789a0f8819d2d365b8a06b (commit)

Summary of changes:
 share/static/js/userautocomplete.js | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

- Log -----------------------------------------------------------------
commit 71773b0b419abddd1146c672957a84d836f04ea6
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 : "")
+        });
+    });
+
 });

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


More information about the Rt-commit mailing list