[rt-devel] extending tickets autocomplete

Alex Vandiver alexmv at bestpractical.com
Mon Jun 23 13:20:31 EDT 2014


On 06/20/2014 03:18 AM, Christian Loos wrote:
> for a custom ticket create form I need an ticket autocomplete which
> limit the returned tickets by queues and customfield values.
> 
> Creating a new helper isn't sufficient because the autocomplete helper
> names are hard coded in share/static/js/autocomplete.js.
> 
> Thinking about making the ticket autocomplete more flexible I came up
> with two solutions:
> 
> 1. change share/static/js/autocomplete.js to match for the end of the
> helper name, so a new FooBarTickets helper is treated the same as the
> Tickets helper

Hm.  I think I'm vaguely in favor of this, since it allows easy
extensibility for, say, Assets.  But, as you note, several places
hardcode behavior changes based on what = "Tickets" -- are you
suggesting that it would match data-autocomplete="FooBarTickets" and
parse out the Tickets, and perform the remained of the function with
what = "Tickets", but call /Helpers/Autocomplete/FooBarTickets ?

> 2. add the possibility to use a new data-autocomplete-query attribute
> which lets you define some ticket sql which is added to the query in
> share/html/Helpers/Autocomplete/Tickets

This goes down the path of specializing ticket autocomplete more, rather
than giving us more rope for other kinds of autocomplete, so I think I'd
prefer an alternate solution.

> Also, what is the use case for the cssClassMap in
> share/static/js/autocomplete.js?
> I couldn't find anything that uses this css classes in the code.

Explained in 315f007faed524e600c2c13fc4c13d8ebfa1e456 -- but I believe
that the reason is now moot, since the data-autocomplete="User" selector
pretty much fulfills that need.
 - Alex


More information about the rt-devel mailing list