Ordering custom fields

79 views
Skip to first unread message

Christopher Nelson

unread,
Sep 26, 2012, 10:26:37 AM9/26/12
to trac...@googlegroups.com
I'm using Trac 0.11.6 and I have quite a few custom fields. I use
MasterTickets plugin which adds blockedby (Depends on) and blocking
(Required for).

I like to have Depends On to the left of Required For since there is a
visual clue that the left column is tickets are before this one and
the right is tickets after. But I can't figure out how to do this
both at the top of the ticket (where current values are displayed) and
at the bottom (where values can be entered/changed).

At the top, the fixed, core fields that are displayed in the table
are: Reporter, Owner, Priority, Milestone, Component, Version, and CC
(7 fields).

At the bottom, the fixed, core fields that are displayed in the table
are: Type, Priority, Milestone, Component, Version, and CC (6 fields).

To put Depends On to the left of Required For at the top, Depends On
would have to be an even field number (0, 2, 4, etc. are on the left)
but to align them at the bottom, it'd have to be an odd field number.

Am I missing something that will help me line up my fields?


Chris

Brettschneider Falk

unread,
Sep 26, 2012, 11:29:33 AM9/26/12
to trac...@googlegroups.com
Christopher Nelson wrote:
> Am I missing something that will help me line up my fields?

You can align the bottom part for instance by using:
http://trac-hacks.org/wiki/GroupTicketFieldsPlugin

CU, F@lk

----
Falk Brettschneider
R&D Software
Baumer Optronic GmbH
www.baumer.com


Gesch?ftsf?hrer: Marcel Seeber * Dr. Oliver Vietze
Sitz der Gesellschaft: Radeberg
Amtsgericht Dresden: HRB 15379
Ust. ID: DE 189714583


Christopher Nelson

unread,
Sep 26, 2012, 1:33:08 PM9/26/12
to trac...@googlegroups.com
>> Am I missing something that will help me line up my fields?
>
> You can align the bottom part for instance by using:
> http://trac-hacks.org/wiki/GroupTicketFieldsPlugin

I like that! Thanks.

I'm stuck in 0.11.6 now but I hope this works with 1.0 as I hope to
move soon and would have to lose a feature if the plugin wasn't
compatible.

Brettschneider Falk

unread,
Sep 27, 2012, 2:11:26 AM9/27/12
to trac...@googlegroups.com
Hi,
Christopher Nelson wrote:
> F@lk wrote:
> > http://trac-hacks.org/wiki/GroupTicketFieldsPlugin
> ... I hope this works with 1.0...
Yes, works well. I already tagged the Trac-Hacks wiki page with 1.0.

Christopher Nelson

unread,
Sep 27, 2012, 8:16:00 AM9/27/12
to trac...@googlegroups.com
>> ... I hope this works with 1.0...
> Yes, works well. I already tagged the Trac-Hacks wiki page with 1.0.

Great!

Christopher Nelson

unread,
Sep 27, 2012, 8:33:55 AM9/27/12
to trac...@googlegroups.com
Alas it appears to be for 0.12 (the source tree I checked out has
0.12/trunk) and I'm in 0.11.6 (I see errors).

2012-09-27 08:30:07,992 Trac[loader] DEBUG: Loading groupticketfields
from /opt/trac/mytrac/plugins/GroupTicketFields-0.0.1dev-py2.6.egg
2012-09-27 08:30:07,993 Trac[loader] ERROR: Skipping
"groupticketfields = groupticketfields": (can't import "ImportError:
cannot import name add_script_data")

I don't know what add_script_data is but I'll have to look into it, I guess.

Brettschneider Falk

unread,
Sep 27, 2012, 8:45:55 AM9/27/12
to trac...@googlegroups.com
Christopher Nelson wrote:
> Alas it appears to be for 0.12 (the source tree I checked out has
> 0.12/trunk) and I'm in 0.11.6 (I see errors).
...
> cannot import name add_script_data")

Yes, that add_script_data() is a new API function of 0.12. A porting-back-to-0.11 discussion is running at #10240 (though for another plugin). There are already hints what is to do; if you provided a patch, the benefit would be doubled.

Christopher Nelson

unread,
Sep 27, 2012, 8:49:08 AM9/27/12
to trac...@googlegroups.com
> Yes, that add_script_data() is a new API function of 0.12. A porting-back-to-0.11 discussion is running at #10240 (though for another plugin). There are already hints what is to do; if you provided a patch, the benefit would be doubled.

Is that ticket at Edgewall or T-H?

Brettschneider Falk

unread,
Sep 27, 2012, 8:49:30 AM9/27/12
to trac...@googlegroups.com
Sorry, I wasn't aware anymore GroupTicketFieldsPlugin also uses add_script_data().

Brettschneider Falk

unread,
Sep 27, 2012, 8:51:24 AM9/27/12
to trac...@googlegroups.com
Christopher Nelson wrote:
> Is that ticket at Edgewall or T-H?

http://trac-hacks.org/ticket/10240

Christopher Nelson

unread,
Oct 9, 2012, 2:58:33 PM10/9/12
to trac...@googlegroups.com
On Thu, Sep 27, 2012 at 8:45 AM, Brettschneider Falk
<fbretts...@baumer.com> wrote:
> Christopher Nelson wrote:
>> Alas it appears to be for 0.12 (the source tree I checked out has
>> 0.12/trunk) and I'm in 0.11.6 (I see errors).
> ...
>> cannot import name add_script_data")
>
> Yes, that add_script_data() is a new API function of 0.12. A porting-back-to-0.11 discussion is running at #10240 (though for another plugin). There are already hints what is to do; if you provided a patch, the benefit would be doubled.

I put a patch in http://trac-hacks.org/ticket/10240#comment:7. It
seems a straight-forward addition. With that in place on top of
0.11.6, GroupTicketFields plugin loads without error and I get no JS
run time errors. My ticket includes the configured fieldset:

<fieldset class="property_group"
id="properties_relationships"><legend>Relationships</legend><table
id="table_relationships"></table></fieldset>

but whereas the plugin does:

groups_list = { 'field_groups': groups }
group_order = { 'field_groups_order': group_order }
data['fields'] = filtered_fields
data['field_groups'] = groups

add_script_data(req, groups_list)
add_script_data(req, group_order)

I can't find the string "groups" in the page source of the ticket display.

Any clues I can pursue would be welcome.


Chris

RjOllos

unread,
Oct 9, 2012, 7:05:53 PM10/9/12
to trac...@googlegroups.com


On Tuesday, October 9, 2012 11:58:55 AM UTC-7, Chris Nelson wrote:
Any clues I can pursue would be welcome.

Assuming what I posted in [1] is the rest of the story, I tend to think Jun's solution is better, because IIRC, it can be implemented entirely in the py file using the ITemplateStreamFilter interface.

Christopher Nelson

unread,
Oct 9, 2012, 8:49:11 PM10/9/12
to trac...@googlegroups.com
I suppose it is for certain definitions of "better". I prefer the
spot fixes of adding functionality rather than slicing and dicing the
plugin to change how it implements the addition of its script data to
the HTML.

RjOllos

unread,
Oct 10, 2012, 6:44:08 PM10/10/12
to trac...@googlegroups.com
On Tuesday, October 9, 2012 5:49:33 PM UTC-7, Chris Nelson wrote:
I suppose it is for certain definitions of "better".

I was thinking mainly of time-to-solution and simplicity. Though if you eventually get to the bottom of this, it would make for a useful recipe, and we could capture it under the forthcoming PluginDev page hierarchy, on a page such as CompatibilityRecipes.
Reply all
Reply to author
Forward
0 new messages