Edgewall Software
Modify

Opened 6 years ago

Closed 2 years ago

Last modified 17 months ago

#11317 closed enhancement (fixed)

Allow navigation items to be added through the mainnav or metanav sections

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.3.2
Component: general Version:
Severity: normal Keywords: navigation
Cc: leho@… Branch:
Release Notes:

Made the navigation more configurable.

  • Entries can be added to the navigation
  • Entries provided by Trac and plugins can be moved the between meta and main navigation
  • Added a permission attribute for controlling visibility of the entry
API Changes:

Added the deregister entry to the ComponentMeta class. This is mainly useful in tests for removing a component with extension points from the cache so that's it's not visible outside of the test case in which it is used.

Description (last modified by Ryan J Ollos)

As mentioned at the bottom of the TracNavigation page, ​NavAddPlugin or ​MenusPlugin are still needed in order to add items to the navigation bars. It would be nice to be able to add new items that are defined in the mainnav and metanav sections, and without the use of plugins.

Two other features to consider:

  • NavAddPlugin allows a permission to be specified for controlling visibility of the nav item.
  • It would be useful to allow items to be moved between the metanav and mainnav by putting to item to the corresponding section of trac.ini ([mainnav] and [metanav]).

Attachments (0)

Change History (16)

comment:1 by lkraav <leho@…>, 6 years ago

Cc: leho@… added

comment:2 by lkraav <leho@…>, 5 years ago

what are we thinking here @rjollos? probably an admin panel? or just improved handling of unknown [mainnav] config items?

Last edited 2 years ago by Ryan J Ollos (previous) (diff)

in reply to:  2 comment:3 by Ryan J Ollos, 5 years ago

Replying to lkraav <leho@…>:

what are we thinking here @rjollos? probably an admin panel? or just imnproved handling of unknown [mainnav] config items?

First, providing support for adding unknown [mainnav] items. Eventually, add an admin panel.

comment:4 by lkraav <leho@…>, 5 years ago

th:NavAddPlugin is working well for me so far. shouldn't be difficult to import that code into core. are you aware of any shortcomings with it?

comment:5 by Ryan J Ollos, 5 years ago

Unfortunately the code in th:NavAddPlugin doesn't provide a useful starting point. One major defect is that the active navigation item is not highlighted (th:#592). When implementing the feature in Trac we'll need to define the extra navigation items in the [mainnav] and [metanav] sections. The code will need to be implemented in Chrome.prepare_request().

I have a PoC of the feature that I'll post in a short while along with some issues that need to be solved.

Last edited 5 years ago by Ryan J Ollos (previous) (diff)

comment:6 by Ryan J Ollos, 5 years ago

Initial implementation in log:rjollos.git:t11317. The active navigation item is not highlighted, so more work is needed.

comment:7 by Ryan J Ollos, 4 years ago

Owner: Ryan J Ollos removed

comment:8 by Ryan J Ollos, 3 years ago

Milestone: next-dev-1.1.xnext-dev-1.3.x

comment:9 by Ryan J Ollos, 3 years ago

Description: modified (diff)

comment:10 by Ryan J Ollos, 3 years ago

Description: modified (diff)

comment:12 by Ryan J Ollos, 3 years ago

Milestone: next-dev-1.3.x1.3.2
Owner: set to Ryan J Ollos
Status: newassigned

comment:13 by Ryan J Ollos, 3 years ago

API Changes: modified (diff)
Release Notes: modified (diff)

Proposed changes in [c5641582/rjollos.git].

  • I'll add more test coverage before committing changes.
  • Documentation has been updated to describe the new features, see comment:11.

The changes include a new method ComponentMeta.deregister. This aims to be a replacement for EnvironmentStub.clear_component_registry and EnvironmentStub.restore_component_registry. The downside to using those methods is that all components are removed from the registry, including those you may want to be active in the test case. clear_component_registry must be called after the EnvironmentStub is activated, so it doesn't allow selectively enabling/disabling components through the arguments to the initializer, instead it's necessary to call EnvironmentStub.enable_component or define the test component class after the registry is cleared. With ComponentMeta.deregister we can just cleanup the test components at the end of the test case, in tearDown or tearDownClass, and selectively enable/disable the built-in components that we want to be visible in the test case.

comment:14 by Ryan J Ollos, 3 years ago

More tests and fixes in [01e17f99/rjollos.git] (log:rjollos.git:t11317_navadd.1). The active menu item is only highlighted when the path matches the href attribute.

Last edited 3 years ago by Ryan J Ollos (previous) (diff)

comment:15 by Ryan J Ollos, 2 years ago

Resolution: fixed
Status: assignedclosed

Committed to trunk in r15777.

comment:16 by Ryan J Ollos, 17 months ago

Python3 compatible revision of r15777 in r16611.

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 as closed 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.