#11956 closed enhancement (fixed)
Replace [trac] mainnav and [trac] metanav with order attributes of the corresponding sections
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.1.5 |
Component: | general | Version: | |
Severity: | normal | Keywords: | navigation |
Cc: | Branch: | ||
Release Notes: |
The |
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Since we have [mainnav]
and [metanav]
sections in trac.ini, it seems odd to have the order of the entries still determined through the [trac]
mainnav
and metanav
options. Instead we could add an .order
attribute to each option in the [mainnav]
and [metanav]
section.
This might also give us a way to address the issue of the names of the items being undocumented, particularly for plugins (gmessage:trac-users:rGMQ0XPRsww/8Rm85C0F8wQJ). Perhaps all the navigation items provided by plugins could be written to the section with a .order
attribute. This might somehow be related to #11437.
Attachments (0)
Change History (13)
comment:1 by , 10 years ago
Description: | modified (diff) |
---|
comment:2 by , 10 years ago
Milestone: | undecided → 1.1.5 |
---|
follow-up: 5 comment:3 by , 10 years ago
comment:4 by , 10 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:5 by , 10 years ago
Replying to rjollos:
I'm debating some points. It makes sense to have all the navigation item configuration options in the
[mainnav]
and[metanav]
sections. However, it is potentially more difficult to reorder those items using the.order
attribute. For example, suppose I want to add new as the first item.
We use th:MenusPlugin. I use multiples of 100 for .order
property to add a new entry without changes during a situation like this.
wiki.order = 100 tickets.order = 200 timeline.order = 300 admin.order = 400 new.order = 50
It might be good to allow float values for .order
property.
wiki.order = 1 tickets.order = 2 timeline.order = 3 admin.order = 4 new.order = 0.5
comment:7 by , 10 years ago
Proposed changes in log:rjollos.git:t11956.
Documentation updated in 1.1/TracNavigation@2.
comment:8 by , 10 years ago
I tried the proposed branch. New environment doesn't have [mainnav]
and [metanav]
sections. As the result, the navigations have broken orders. We should generate the sections with default orders on initenv
.
Also, I think we should sort by .order
and the name because list.sort
method is unstable sort.
- nav[category].sort(key=lambda e: order[e['name']]) + nav[category].sort(key=lambda e: (order[e['name']], e['name']))
comment:9 by , 10 years ago
Thanks for the feedback. Revised changes in log:rjollos.git:t11956-nav-order. The behavior has changed slightly. Previously Admin was not specified in the ordering, but it is now specified as the last (right-most) entry.
Documentation updated in 1.1/TracNavigation@3.
comment:11 by , 10 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
I made a minor modification to write floating point values to the config file on initialization (e.g. 1.0
rather than 1
). Changes committed to trunk in [14045].
comment:12 by , 10 years ago
Comment of do_upgrade()
in db41.py
says [ticket-custom]
section like this.
"""Move [trac] mainnav and [trac] metanav to .order attributes of the [ticket-custom] section.
That should be [mainnav]
and [metanav]
sectinos….
I'm debating some points. It makes sense to have all the navigation item configuration options in the
[mainnav]
and[metanav]
sections. However, it is potentially more difficult to reorder those items using the.order
attribute. For example, suppose I want to add new as the first item.→
We potentially have to edit all N navigation items. Maybe that isn't too inconvenient though since it's unrealistic to have more than 10 or so items on the mainnav. After #11469 is implemented we could add an admin panel for conveniently reordering the items, similar to the ticket enums (Severities, Versions, …).