Modify

Opened 4 years ago

Closed 9 days ago

#8477 closed enhancement (fixed)

Add support for custom fields

Reported by: sukender at free.fr Owned by: rjollos
Priority: normal Component: AutocompleteUsersPlugin
Severity: normal Keywords:
Cc: ejucovy Trac Release: 0.11

Description

It could be nice to be able to have autocompletion on users' fields via trac.ini. Ex:

[AutocompleteUsers]
custom_fields = myField, anotherField

Attachments (3)

enable-autocomplete-dropdown-list-and-support-custom-fields.patch (13.5 KB) - added by t2y 11 months ago.
$ svn di > enable-autocomplete-dropdown-list-and-support-custom-fields.patch
enable-autocomplete-dropdown-list-and-support-custom-fields-for-review.patch (6.6 KB) - added by t2y 11 months ago.
$ svn di -x -w > enable-autocomplete-dropdown-list-and-support-custom-fields-for-review.patch
enable-autocomplete-dropdown-list-and-support-custom-fields-for-r13962.patch (13.7 KB) - added by t2y 4 months ago.
$ svn di > enable-autocomplete-dropdown-list-and-support-custom-fields.patch for r13962

Download all attachments as: .zip

Change History (21)

comment:1 Changed 2 years ago by ejucovy

  • Cc ejucovy added

comment:2 Changed 11 months ago by t2y

I'll implement this.

comment:3 Changed 11 months ago by rjollos

Excellent. I will have some time this weekend to review your patch in #11415 as well.

Changed 11 months ago by t2y

$ svn di > enable-autocomplete-dropdown-list-and-support-custom-fields.patch

Changed 11 months ago by t2y

$ svn di -x -w > enable-autocomplete-dropdown-list-and-support-custom-fields-for-review.patch

comment:4 Changed 11 months ago by t2y

Note: attached patch includes the ticket:11415#comment:1 changes.

Patch summary:

This patch allow to enable auto complete function for custom fields. First of all, we need to set the custom field name into trac.ini. The configuration values are passed to javascript as a global variable with add_script_data() function.

[autocomplete_users]
custom_fields = managers, reviewers

I confirmed that it works on trac-0.12.1 and trac-1.0.2dev.

comment:5 Changed 10 months ago by t2y <tetsuya.morimoto@…>

Could you review this?

comment:6 Changed 10 months ago by rjollos

It is in my Queue. It's a FIFO, so it will be a few more days before I can review.

The feature suggested in this ticket sounds fine to me, so I'm likely to commit the changes, even if they require some modification first. I'm less certain of ticket #11415. It would help move things along if you could provide a patch for just the features in this ticket. That should be fairly easy to do if you commit the patches into a DVCS such as Git.

Changed 4 months ago by t2y

$ svn di > enable-autocomplete-dropdown-list-and-support-custom-fields.patch for r13962

comment:8 Changed 3 months ago by t2y

We published the clone repository applying this patch. Try it!

https://github.com/arielnetworks/autocompleteusersplugin

comment:9 Changed 2 months ago by t2y

Originally, this fields list option of autocomplete section was added in r4407 (#3719) for drop down list. Now, I already supported to complement for drop down list in r14116 (#11415).

    selectfields = ListOption('autocomplete', 'fields', default='',              
        doc="select fields to transform to autocomplete text boxes")

Additionally, #3719 was closed with the unclear purpose. So, I think this fields option can be used to choose arbitrary fields without adding another settings: custome_fields. To specify fields to be complement is like this into trac.ini.

[autocomplete]
fields = custom_field1, custom_field2

comment:10 Changed 2 months ago by t2y

add_script_data() is not found in Trac 0.11.8dev.

http://trac-hacks.org/ticket/10240#comment:7

comment:11 Changed 2 months ago by t2y

I tried to replace add_script_data() with as below, but the data was not given to javascript.

req.chrome.setdefault('script_data', {}).update(data)

comment:12 Changed 2 months ago by t2y

hmm, to_json is still needed.

http://trac-hacks.org/ticket/10240#comment:9

comment:13 follow-up: Changed 2 months ago by jun66j5

I consider that we could pass values of fields option using add_script_data in post_process_request if available (Trac 0.12 and later). Otherwise, we could add script element with values of the option in filter_stream. In that case, we could use javascript_quote instead of to_json because the option is just a list of string.

See also post_process_request and filter_stream in tracdragdropplugin/0.11/tracdragdrop/web_ui.py.

comment:14 in reply to: ↑ 13 Changed 11 days ago by t2y

Replying to jun66j5:

See also post_process_request and filter_stream in tracdragdropplugin/0.11/tracdragdrop/web_ui.py.

I could implement to_json using what you referred, then I confirmed it works on Trac-0.11.
Thank you for your advice!

comment:15 Changed 11 days ago by t2y

I committed to my repository for trunk-revision(r14198). I'm going to do testing whether this change works for all version (0.11.x, 0.12.x, 1.0.x). To specify custom fields, see comment:9.

https://github.com/arielnetworks/autocompleteusersplugin/commit/5134011df3eabce847c77015e147e13c106b2ba6

Last edited 11 days ago by t2y (previous) (diff)

comment:16 Changed 9 days ago by t2y

I tested on 0.11.x, 0.12.x and 1.0.2-beta and it seems good. :)

comment:17 Changed 9 days ago by t2y

In 14212:

Refs #8477: Add support for custom fields

comment:18 Changed 9 days ago by t2y

  • Resolution set to fixed
  • Status changed from new to closed
  • Trac Release changed from 0.12 to 0.11

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.