Re: extending tickets autocomplete

Alex Vandiver <[email protected]>
Newsgroups gmane.comp.bug-tracking.request-tracker.devel
Organization Best Practical Solutions, LLC
Message-ID <[email protected]>
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
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.