Is there a way to control the ABSOLUTE (and not relative) order of custom and non-custom fields?

已查看 61 次
跳至第一个未读帖子

ConnieRunOnTrac

未读,
2007年11月1日 12:35:352007/11/1
收件人 Trac Users
Hi I need help on the following, wondering if anyone can answer this?

I would like to control the ABSOLUTE order of the custom and out of
the box fields. I know in ini file, I can specify the ORDER using
".order" under the [ticket_custom] section. I searched through google,
but could not find anything....help! I want to do something like this:
any idea?? In the ticket properties, I want the fields to show up with
the following order

Priority Keywords
Severity Assign to
Component --empty--
Custom field 1 Custom field 2
Custom field 3 Custom field 4
Custom field 5 --empty--
Custom field 6 --empty--
Custom field 7 --empty--

Thanks in advance!

Geoff Robinson

未读,
2007年11月1日 17:32:362007/11/1
收件人 Trac Users
Hi, this doesn't exactly answer the absolute ordering question - but
when I was working through this I used custom fields as spacers with
only ':' as content. In your case you would use 4 spacers ordered so
they would offset your other custom fields properly.

Hope this helps,

Geoff

ConnieRunOnTrac

未读,
2007年11月1日 23:15:352007/11/1
收件人 Trac Users
Geoff
Thanks for reply. I actually figured this out: In the cs template
file, I did this:

<?cs if: field.label == 'O/S' ?><?cs set:fullrow = 1 ?>
<?cs /if ?>
'O/S' is the name of my custom field and the next field now got pushed
right below it!

Mo

未读,
2016年11月15日 07:38:322016/11/15
收件人 Trac Users
Hi, I'm also looking for a way to define a custom order for non-custom ticket fields and custom ticket fields.

As for the custom there is this possibility:

project = select
project.order = 5

But there is no way to define that for internal fields such as type and priority. It would be nice to set the internals in [ticket-custom] as well by defining the order only.
There was already a request like this before:
https://trac-hacks.org/ticket/2642#comment:11

Is redefining the CS template the only way? Which template define the ticket fields?

br, Mo

RjOllos

未读,
2016年11月16日 19:00:012016/11/16
收件人 Trac Users


On Tuesday, November 15, 2016 at 4:38:32 AM UTC-8, Mo wrote:
Hi, I'm also looking for a way to define a custom order for non-custom ticket fields and custom ticket fields.

As for the custom there is this possibility:

project = select
project.order = 5

But there is no way to define that for internal fields such as type and priority. It would be nice to set the internals in [ticket-custom] as well by defining the order only.
There was already a request like this before:
https://trac-hacks.org/ticket/2642#comment:11

Is redefining the CS template the only way? Which template define the ticket fields?

br, Mo


This thread is pretty old and the CS template refers to the pre-0.11 version of Trac that used ClearSilver.

Trac doesn't currently support re-ordering the standard ticket fields. The feature has been requested in #4549 and I would agree that this is something we should address in the near future.
https://trac.edgewall.org/ticket/4549

For now, I've written a plugin that will allow you to re-order the ticket fields, subject to a few restrictions. See attached TicketFieldOrderer.py.

The visible fields in the Ticket Properties box can be reordered, excepted "Reported by" and "Owned by". You'll have the change the ticket_box.html template to change the position of those fields.



The visible fields in the Change Properties box can be reordered.



The plugin implements IRequestFilter, so it can override ordering of ticket custom fields defined in Trac.ini. I haven't tested, but I think it will preserve ordering of custom fields as defined in Trac.ini provided you don't list any of those fields in [ticket] field_order.

- Ryan
 
TicketFieldOrderer.py
Auto Generated Inline Image 1
Auto Generated Inline Image 2

Mo

未读,
2016年11月17日 04:28:302016/11/17
收件人 Trac Users
Hi, thank you for your fast solution.

How can I install a single .py as Plugin?
Trying to understand how to configure it, would this be a correct configuration by listing all fields in the desired order?

[ticket]
field_order = type, priority, milestone, component, version, keywords, cc

I don't even know the internal names of the builtin fields.

BR,
Mo

RjOllos

未读,
2016年11月17日 04:35:372016/11/17
收件人 Trac Users


On Thursday, November 17, 2016 at 1:28:30 AM UTC-8, Mo wrote:
Hi, thank you for your fast solution.

How can I install a single .py as Plugin?

 
Trying to understand how to configure it, would this be a correct configuration by listing all fields in the desired order?

 
[ticket]
field_order = type, priority, milestone, component, version, keywords, cc

I don't even know the internal names of the builtin fields.

Yes, that looks good. For internal names, see first column of tuple or name entry of dictionary here:
 
BR,
Mo

- Ryan 

RjOllos

未读,
2016年11月28日 04:57:332016/11/28
收件人 Trac Users

The version of the plugin I posted before incorrectly cached data['fields'], so ticket property changes would not be shown in the ticket properties box. The attached version of the plugin fixes that issue.

- Ryan
 
TicketFieldOrderer.py

Mo

未读,
2016年12月13日 04:47:502016/12/13
收件人 Trac Users
Hi, is there any plan or ticket to integrate your code into the core? Custom sorting of ticket fields is mandatory.

We added different roles like tester, reviewer with state flag. These must be side by side:

Test: Open       Tester: John
Review: Done   Reviewer: Steve

Adding single fields in front destroys the alignment, so a generic type "dummy" would be required, as special keyword for your field_order only, that only adds a invisible placeholder.
Then section separators like horizontal line would be nice. In general an adjustable ticket template would be nice.

Jun Omae

未读,
2016年12月13日 05:09:322016/12/13
收件人 trac-...@googlegroups.com
On Tue, Nov 15, 2016 at 9:38 PM, Mo <burcheri...@gmail.com> wrote:
> Hi, I'm also looking for a way to define a custom order for non-custom
> ticket fields and custom ticket fields.
>
> As for the custom there is this possibility:
>
> project = select
> project.order = 5
>
> But there is no way to define that for internal fields such as type and
> priority. It would be nice to set the internals in [ticket-custom] as well
> by defining the order only.
> There was already a request like this before:
> https://trac-hacks.org/ticket/2642#comment:11
>
> Is redefining the CS template the only way? Which template define the ticket
> fields?

See https://trac-hacks.org/wiki/TracTicketFieldsLayoutPlugin.

--
Jun Omae <jun...@gmail.com> (大前 潤)

Mo

未读,
2017年1月2日 09:38:162017/1/2
收件人 Trac Users
Hi,

Jun Omae, I appreciate that TracTicketFieldsLayoutPlugin as it is quite useful for our case, it would be moreover useful to have a custom column count instead of the fixed 2 column layout currently. However there is a big blocker about this plugin as it says it will not be ported to any Trac 1.4+. We are currently on 1.0.9 but I would avoid in any case to have more dependencies that could break future updates. I currently have many addons I need to keep up to date. So having in mind that this plugin will be obsolete soon I would not like getting used to it...

@RjOllos : I found some major issue with the field_order variable of your plugin. The ticket mask is implicitly different when creating a new ticket or modifying an old one, as the old one has missing the owner field.

Having this order:
field_order = type, customer, project, version, component, owner, priority, platform, parents, keywords, development, developer, review, reviewer, test, tester, documentation, author, service, serviceer, integration, integrator, propagation, customer, cc
I completely depend on the field order for having test and tester side by side in the 2-column layout. Any idea? I could move the owner right to the end of the list, but then I would need an empty dummy, like a keyword 'null' or something.

Best regards.
Mo

RjOllos

未读,
2017年1月2日 10:48:492017/1/2
收件人 Trac Users


On Monday, January 2, 2017 at 9:38:16 AM UTC-5, Mo wrote:
Hi,

Jun Omae, I appreciate that TracTicketFieldsLayoutPlugin as it is quite useful for our case, it would be moreover useful to have a custom column count instead of the fixed 2 column layout currently. However there is a big blocker about this plugin as it says it will not be ported to any Trac 1.4+. We are currently on 1.0.9 but I would avoid in any case to have more dependencies that could break future updates. I currently have many addons I need to keep up to date. So having in mind that this plugin will be obsolete soon I would not like getting used to it...

@RjOllos : I found some major issue with the field_order variable of your plugin. The ticket mask is implicitly different when creating a new ticket or modifying an old one, as the old one has missing the owner field.

Having this order:
field_order = type, customer, project, version, component, owner, priority, platform, parents, keywords, development, developer, review, reviewer, test, tester, documentation, author, service, serviceer, integration, integrator, propagation, customer, cc
I completely depend on the field order for having test and tester side by side in the 2-column layout. Any idea? I could move the owner right to the end of the list, but then I would need an empty dummy, like a keyword 'null' or something.

Best regards.
Mo

TicketFieldOrderer.py will not work in Trac 1.4 for the same reason that TracTicketFieldsLayoutPlugin will not work - the Genshi library is being replaced with Jinja2.

Trac 1.4 may not even be released in 2017. Trac 1.2 is an LTS release that will be supported for many years. With Trac 1.4+, a new plugin will need to be written to replace TracTicketFieldsLayoutPlugin.

For now, unless there's a plugin I'm unaware of, TracTicketFieldsLayoutPlugin is your only choice.

- Ryan
回复全部
回复作者
转发
0 个新帖子