rt 4.0.23
[freeside.git] / rt / share / html / NoAuth / js / userautocomplete.js
index b4f678c..c2b5a4a 100644 (file)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -105,6 +105,22 @@ jQuery(function() {
         if (queryargs.length)
             options.source += "?" + queryargs.join("&");
 
-        jQuery(input).autocomplete(options);
+        jQuery(input)
+            .addClass('autocompletes-user')
+            .autocomplete(options)
+            .data("autocomplete")
+            ._renderItem = function(ul, item) {
+                var rendered = jQuery("<a/>");
+
+                if (item.html == null)
+                    rendered.text( item.label );
+                else
+                    rendered.html( item.html );
+
+                return jQuery("<li/>")
+                    .data( "item.autocomplete", item )
+                    .append( rendered )
+                    .appendTo( ul );
+            };
     }
 });