> Any clues appreciated. I have no idea how to start debugging code in
> a Genshi template.
>
> (Confirmation that I'm not the only one seeing weird custom field
> placement would be nice, too.)
So, I fixed this but the fix is an ugly hack. I'd appreciate feedback
on a better way to do this (or how/why it gets broken to start with).
Applying the following patch to Trac 0.11.6 makes the custom fields
show up in the configured order. It also puts keywords back at the
end. There is code to do that in web_ui.py but the bug I'm fixing
here -- whatever its source -- undoes that careful ordering and I see
keywords in the middle of the property box at the top of a ticket.
First, stick a field in the tickets to note the field order intended
by _prepare_fields:
diff --git a/trac/ticket/web_ui.py b/trac/ticket/web_ui.py
index c1bc19f..56d6b02 100644
--- a/trac/ticket/web_ui.py
+++ b/trac/ticket/web_ui.py
@@ -1213,6 +1213,13 @@ class TicketModule(Component):
if keywords_field is not None:
fields.remove(keywords_field)
fields.append(keywords_field)
+
+ # Force this ordering across all fields, not just custom, for
+ # the property box at the top
+ i = 0
+ for field in fields:
+ field['_prop_order'] = i
+ i = i + 1
return fields
Then, in the template, sort the fields before displaying them:
index 07ff68b..a10f06a 100644
--- a/trac/ticket/templates/ticket.html
+++ b/trac/ticket/templates/ticket.html
@@ -149,9 +149,9 @@
<!-- use a placeholder if it's a new ticket -->
<h2 class="summary searchable">$ticket.summary</h2>
- <table class="properties"
- py:with="fields = [f for f in fields if not f.skip and f.name
- not in ('type', 'owner')]">
+ <table class="properties"
+ py:with="fields = sorted([f for f in fields if not f.skip and
+ not in ('type', 'owner')], key=lambda f: f[
<tr>
<th id="h_reporter">Reported by:</th>
<td headers="h_reporter" class="searchable">${authorinfo(ticket.r
The question is, how/when did the fields get reordered.
Chris
--
You received this message because you are subscribed to the Google Groups "Trac
Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/trac-dev?hl=en.