Modify

Opened 14 years ago

Closed 7 years ago

Last modified 7 years ago

#8477 closed enhancement (fixed)

Add support for custom fields

Reported by: sukender@… Owned by: Ryan J Ollos
Priority: normal Component: AutocompleteUsersPlugin
Severity: normal Keywords:
Cc: ejucovy, Massimo 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 Tetsuya Morimoto 11 years 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 Tetsuya Morimoto 11 years 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 Tetsuya Morimoto 11 years ago.
$ svn di > enable-autocomplete-dropdown-list-and-support-custom-fields.patch for r13962

Download all attachments as: .zip

Change History (33)

comment:1 Changed 12 years ago by ejucovy

Cc: ejucovy added; anonymous removed

comment:2 Changed 11 years ago by Tetsuya Morimoto

I'll implement this.

comment:3 Changed 11 years ago by Ryan J Ollos

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

Changed 11 years ago by Tetsuya Morimoto

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

Changed 11 years ago by Tetsuya Morimoto

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

comment:4 Changed 11 years ago by Tetsuya Morimoto

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 11 years ago by Tetsuya Morimoto

Could you review this?

comment:6 Changed 11 years ago by Ryan J Ollos

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 11 years ago by Tetsuya Morimoto

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

comment:8 Changed 10 years ago by Tetsuya Morimoto

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

https://github.com/arielnetworks/autocompleteusersplugin

comment:9 Changed 10 years ago by Tetsuya Morimoto

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 10 years ago by Tetsuya Morimoto

add_script_data() is not found in Trac 0.11.8dev.

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

comment:11 Changed 10 years ago by Tetsuya Morimoto

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 10 years ago by Tetsuya Morimoto

hmm, to_json is still needed.

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

comment:13 Changed 10 years ago by Jun Omae

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 10 years ago by Tetsuya Morimoto

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 10 years ago by Tetsuya Morimoto

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 10 years ago by Tetsuya Morimoto (previous) (diff)

comment:16 Changed 10 years ago by Tetsuya Morimoto

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

comment:17 Changed 10 years ago by Tetsuya Morimoto

In 14212:

Refs #8477: Add support for custom fields

comment:18 Changed 10 years ago by Tetsuya Morimoto

Resolution: fixed
Status: newclosed
Trac Release: 0.120.11

comment:19 Changed 8 years ago by massimo.b@…

Hast this change already been integrated into the official trunk branch? I see the change r14212 there. However custom_fields and restrict_owner are not documented. This does not work here with Trac 1.0.9:

[autocomplete_users]
custom_fields = testers

[ticket-custom]
testers = text
testers.label = Testers
testers.order = 20
testers.value =

While Cc works, the "Testers" field has no completion.

comment:20 in reply to:  19 Changed 8 years ago by Jun Omae

Replying to massimo.b@…:

Hast this change already been integrated into the official trunk branch? I see the change r14212 there. However custom_fields and restrict_owner are not documented. This does not work here with Trac 1.0.9:

The option is documented in TracIni page of your Trac.

[autocomplete_users]
custom_fields = testers
...

While Cc works, the "Testers" field has no completion.

The section should be [autocomplete].

[autocomplete]
custom_fields = testers

comment:21 Changed 8 years ago by massimo.b@…

Thanks, it works with

[autocomplete]
fields = testers

Although the behavior is different from the Cc which also adds a ", " after completion.

But this is not part of the core, it is still provided by this plugin? Didn't know that TracIni gets updated by plugins... However should be documented in the plugin wiki as well.

comment:22 in reply to:  21 ; Changed 8 years ago by Jun Omae

Replying to massimo.b@…:

But this is not part of the core, it is still provided by this plugin?

That shouldn't be discussed in this ticket.

Didn't know that TracIni gets updated by plugins... However should be documented in the plugin wiki as well.

Anyone can modify the AutocompleteUsersPlugin page and could provide document in the plugin page at any time.

Last edited 8 years ago by Ryan J Ollos (previous) (diff)

comment:23 in reply to:  22 Changed 8 years ago by massimo.b@…

Replying to jun66j5:

Replying to massimo.b@…:

However should be documented in the plugin wiki as well.

Anyone can modify the AutocompleteUsersPlugin page and could provide document in the plugin page at any time.

Done in AutocompleteUsersPlugin@47.

Last edited 8 years ago by Jun Omae (previous) (diff)

comment:24 Changed 7 years ago by Massimo

Cc: Massimo added

We are using this for a while now in order to autocomplete custom fields, like this:

[autocomplete]
fields = tester,reviewer,author,integrator,developer,serviceer
multiple = true

This works fine, but for the custom fields, only the first user is autocomplete, it doesn't work for any of the next separated by ','.

Last edited 7 years ago by Massimo (previous) (diff)

comment:25 in reply to:  24 ; Changed 7 years ago by Ryan J Ollos

Replying to Massimo:

This works fine, but for the custom fields, only the first user is autocomplete, it doesn't work for any of the next separated by ','.

Which Trac version? Are you running the latest TracAutocompleteUsersPlugin?

comment:26 Changed 7 years ago by Ryan J Ollos

I've published TracAutocompleteUsersPlugin 0.4.4 to PyPI.

comment:27 in reply to:  25 ; Changed 7 years ago by Massimo

Replying to Ryan J Ollos:

Which Trac version? Are you running the latest TracAutocompleteUsersPlugin?

Trac-1.2. I re-installed the latest trunk from svn, running a TracAutocompleteUsersPlugin-0.4.5-py2.7.egg right now. Same issue. Cc works, but the custom fields complete the first user, but don't add a "," separator and don't complete any further user after the first.

Last edited 7 years ago by Ryan J Ollos (previous) (diff)

comment:28 Changed 7 years ago by Ryan J Ollos

Resolution: fixed
Status: closedreopened

comment:29 Changed 7 years ago by Ryan J Ollos

Status: reopenedaccepted

comment:30 in reply to:  27 Changed 7 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

Replying to Massimo:

Trac-1.2. I re-installed the latest trunk from svn, running a TracAutocompleteUsersPlugin-0.4.5-py2.7.egg right now. Same issue. Cc works, but the custom fields complete the first user, but don't add a "," separator and don't complete any further user after the first.

"Multi" completion is not yet supported for custom fields. See #12952.

Last edited 7 years ago by Ryan J Ollos (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.