Modify

Opened 6 years ago

Closed 6 years ago

#2624 closed enhancement (fixed)

Option to have the link in ctxtnav instead of mainnav

Reported by: izzy Owned by: Blackhex
Priority: normal Component: ScreenshotsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

Since the main navigation bar fills up too much, I'ld prefer to have the item added to the ctxtnav of the wiki instead. Is that possible?

What I tried already: I disabled the items entry in the main navigation bar successfully using the NavHiderPlugin. Then I wanted to add the link conditionally to the ctxtnav in wiki.cs - but I could not figure out how to check whether the ScreenshotsPlugin is enabled (makes no sense to have the link there otherwise). So providing the correct "if:" statement would already solve my problem ;) Searched with Google for hours without finding a result, looking for something like "if:plugin.<name>.enabled"...

Attachments (0)

Change History (4)

comment:1 Changed 6 years ago by izzy

Just found some solution for this:

   <li><a href="<?cs var:trac.href.wiki ?>/RecentChanges">Index by Date</a></li><?cs if:trac.acl.SCREENSHOTS_VIEW ?>
   <li><a href="Screenshots">Screenshots</a></li><?cs /if ?>
   <li class="last"><a href="<?cs var:wiki.last_change_href ?>">Last Change</a></li>

Just a little change to wiki.cs - if you may want to add this hint to your FAQ/plugin article, feel free. Works for me so far - but of course it would be better to have the option somewhere, to not depend on another plugin ;) The other change (to remove the original item from the main navigation bar) was installing and activating NavHiderPlugin plus adding !screenshots to the mainnav setting in trac.ini

comment:2 Changed 6 years ago by Blackhex

  • Status changed from new to assigned

ctxtnav (Context Navigation Bar) is ment for links related to current context (Wiki pages in this case) so there is no direct way how to append an item to this bar within different plugin. Although it can be done with certain hacks I'm not willing to incorporate this in plugin since it breaks the logical organization of Trac's navigation.

I can change behavior of plugin the way that if there is an empty string value of title configuration option main navigation button is hidden and append metanav_title option to show link to screenshots in meta navigation bar (above mainnav).

Would you like these changes?

comment:3 Changed 6 years ago by izzy

Though IMHO the metanav is not the most suitable place (as far as I could see, it mostly holds account - login, logout, my account, settings - and trac specific links), it would at least provide an alternative to an overfilled main navigation. As for me, the work-around posted above works fine. So you may go along mention that in the short docu as well. If you'ld provide the possibility to have neither the main nav nor the metanav link used (e.g. by leaving both settings empty), people could decide to add it to their ctxnav like mentioned above.

comment:4 Changed 6 years ago by Blackhex

  • Resolution set to fixed
  • Status changed from assigned to closed

Done in r3271. Now there are mainnav_title and metanav_title config opitons. Each disable item if they are empty (metanav by default). Maybe I'll try to use IRequestFilter::pre_process_request() and match Wiki page requests to add context navigation items from this context if it is possible which would append wiki_title option with similar meaning.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.