Opened 8 years ago

Last modified 5 years ago

#6444 new enhancement

autocomplete other fields (reporter and keywords)

Reported by: Vincent Owned by: Ryan J Ollos
Priority: normal Component: AutocompleteUsersPlugin
Severity: normal Keywords:
Cc: Jun Omae, falkb Trac Release: 0.11


Why not extend Autocomplete to the ticket fields 'reporter' and 'keywords'? Could save time :-)

Attachments (0)

Change History (11)

comment:1 Changed 8 years ago by Ryan J Ollos

Owner: changed from Jeff Hammel to Ryan J Ollos

Changing ticket owner to be new maintainer.

comment:2 Changed 6 years ago by Ryan J Ollos

Keyword autocompletion is handled by the KeywordSuggestPlugin. This plugin could be extended to handle the reporter field though.

comment:3 Changed 6 years ago by Ryan J Ollos

Cc: Jun Omae falkb added; anonymous removed
Status: newassigned

comment:4 Changed 6 years ago by Ryan J Ollos

(In [11736]) Refs #6444: Added support for autocompleting the Reporter field on the ticket page.

comment:5 Changed 6 years ago by falkb

I wonder if autocompletion of fields can be generic in general also for all freely editable fields. For example I have custom ticket field "projects" and users asked me here how they can predict the available names on page "View Tickets"-->"Custom Query". Well, I think about copying your appropriate code to SimpleMultiProjectPlugin but would be cool if it was generic in general. What do you think about this topic?

comment:6 Changed 6 years ago by Ryan J Ollos

At first I read your question as, how can we extend the plugin to autocomplete a user text field on any Trac page?, and I realize now that isn't your specific question, but let me comment on that briefly since I had thought about it before. It would probably be possible to specify a list of paths and selectors in trac.ini and use that information to either modify the Genshi template in ITemplateStreamFilter to add an autocomplete class to the specified elements, or use add_script_data in Trac 0.12 to do all the work in JavaScript.

As for autocompleting fields other than the users field, I tend to think that the jQuery is simple enough that you may just want to implement this directly in your codebase. However, KeywordSuggestPlugin is very similar to this plugin, with the main exception being how the data is stored, and looking for commonality between KeywordSuggestPlugin and AutocompleteUsersPlugin could be a good starting point.

I'd like to figure out how to pull the data directly from the Trac database without having an intermediate /subjects page. We might be able to have some reusable code that takes a database table/column and a selector as arguments, and does all the work of autocompleting any text field. We could then put this project in Trac-Hacks and plugins that need the code could use an svn:externals to pull it in.

comment:7 Changed 6 years ago by Ryan J Ollos

Rather than binding the autocompleter to specific element ids, what do you guys think about adding a class to all elements that we'd like to autocomplete, and then binding the autocompleter to the class? That would allow falkb to autocomplete fields for his SimpleMultiProjectPlugin, and I also have a use-case for this now with the DefaultCcPlugin. I'm not sure though how we'd cleanly differentiate between autocompleting users, groups and both users and groups, but it could be a matter of having several classes: autocomplete-users, autocomplete-groups and autocomplete-users&groups.

Or is there a better way to extend this functionality to other plugins?

comment:8 Changed 6 years ago by falkb

Uhm...for my needs, it would mean to autocomplete a custom ticket field "project" and offer the projects I actually retrieve somehow from the db with simplemultiprojectplugin/trunk/simplemultiproject/ A general solution for autocompletion would likely need a callback function pointer returning a stringlist it uses to work on.

comment:9 Changed 6 years ago by Ryan J Ollos

In that case, I tend to think you are better-off just using Autocomplete from the jQuery UI. Your use case sounds almost exactly like KeywordSuggestPlugin.

It would be nice to generalize AutocompleteUsersPlugin to autocomplete user fields everywhere they are found though, including in plugins, provided the plugin author has take care to do whatever is required to extend the autocomplete functionality to that field.

comment:10 Changed 5 years ago by Ryan J Ollos

Status: assignednew

comment:11 Changed 5 years ago by Ryan J Ollos

#10417 closed as a duplicate.

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain Ryan J Ollos.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.