Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#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 .order attributes of the options in the [mainnav] and [metanav] sections control navigation item sort order. The options [trac] mainnav and [trac] metanav have been removed.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

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 Ryan J Ollos, 9 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 9 years ago

Milestone: undecided1.1.5

comment:3 by Ryan J Ollos, 9 years ago

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.

wiki.order = 1
tickets.order = 2
timeline.order = 3
admin.order = 4

wiki.order = 2
tickets.order = 3
timeline.order = 4
admin.order = 5
new.order = 1

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, …).

comment:4 by Ryan J Ollos, 9 years ago

Owner: set to Ryan J Ollos
Status: newassigned

in reply to:  3 comment:5 by Jun Omae, 9 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 float value for .order property.

wiki.order = 1
tickets.order = 2
timeline.order = 3
admin.order = 4
new.order = 0.5
Version 0, edited 9 years ago by Jun Omae (next)

comment:6 by Ryan J Ollos, 9 years ago

I'll also add a ConfigSection for mainnav and metanav.

comment:7 by Ryan J Ollos, 9 years ago

Proposed changes in log:rjollos.git:t11956.

Documentation updated in 1.1/TracNavigation@2.

comment:8 by Jun Omae, 9 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 Ryan J Ollos, 9 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:10 by Jun Omae, 9 years ago

I tried the rjollos.git@t11956-nav-order. The changes look good to me.

comment:11 by Ryan J Ollos, 9 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

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 Jun Omae, 9 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….

comment:13 by Ryan J Ollos, 9 years ago

Comment corrected in [14046].

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'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.