[PATCH] (suggested) autocomplete users on ticket forms
|Reported by:||Owned by:|
|Cc:||ejucovy@…, Thijs Triemstra, walty8@…|
I've written a plugin, th:AutocompleteUsersPlugin , that uses AJAX to complete users in the owner and CC fields for new and existing tickets (for the latter, at least for the default workflow). The attached patch is the plugin in patch form, fairly unmodified. Performance should degrade gracefully for no JS or when
restrict_owner is true.
The autocompleter completes from known users who have the TICKET_MODIFY permission, mirroring the performance of the select widget when
restrict_owner is true and populates the fields with the user name, though (obfuscated) email and full names are shown in the drop down and are included in the completion algorithm.
I have included
autocomplete.js from http://www.dyve.net/jquery/?autocomplete which is an updated version of the jquery plugin that source:trunk/trac/htdocs/js/suggest.js is based on. The update is needed to decouple what is displayed in the drop-down from what is populated to the input field.
suggest.js could be updated with this as well as the only place it is used, source:trunk/trac/versioncontrol/web_ui/changeset.py , if this is desired.
A new RequestHandler handles requests to
/users to respond to AJAX request. This handler could be made to do more if requests were descriminated upon
req.get_header('X-Requested-With') == 'XMLHttpRequest', or the whole data could be added into the JS on the server side (which is not possible with the existing
autocomplete.js. These could be consolidated and/or generated on the server side if that is more desirable.