Changes between Version 1 and Version 2 of TracNavigation
- Timestamp:
- 08/21/13 19:46:14 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracNavigation
v1 v2 ˆà 3 3 Starting with Trac 0.11, it is now possible to customize the main and meta navigation entries in some basic ways.ˆà 4 4 ˆà 5 ˆà The new `[mainnav]` and `[metanav]` configuration sections can now be used to customize the text and link used for the navigation items, or even to disable them. ˆàˆà 5 The new `[mainnav]` and `[metanav]` configuration sections can now be used to customize the text and link used for the navigation items, or even to disable them. The `mainnav` and `metanav` options in the `[trac]` configuration section can also be used to change the order.ˆà 6 6 ˆà 7 ˆà `[mainnav]` corresponds to the '''main navigation bar''', the one containing entries such as ''Wiki'', ''Timeline'', ''Roadmap'', ''Browse Source'' and so on. This navigation bar is meant to access the default page of the main modules enabled in Trac and accessible for the current user.ˆà ˆà 7 === `[mainnav]` #mainnav-barˆà ˆà 8 `[mainnav]` corresponds to the '''main navigation bar''', the one containing entries such as ''Wiki'', ''Timeline'', ''Roadmap'', ''Browse Source'' and so on. This navigation bar is meant to access the default page of the main modules enabled in Trac that are accessible for the current user.ˆà 8 9 ˆà 9 ˆà `[metanav]` corresponds to the '''meta navigation bar''', by default positioned above the main navigation bar and below the ''Search'' box. It contains the ''Log in'', ''Logout'', ''Help/Guide'' etc. entries. This navigation bar is meant to access some global information about the Trac project and the current user.ˆà10 10 ˆà 11 ˆà Note that it is still not possible to customize the '''contextual navigation bar''', i.e. the one usually placed below the main navigation bar.ˆà ˆà 11 ** [=#Example Example] ** ˆà 12 12 ˆà 13 ˆà === Example ===ˆà 14 ˆà ˆà 15 ˆà In the following example, we rename the link to the Wiki start "Home", and hide the "Help/Guide" link. ˆà 16 ˆà We also make the "View Tickets" entry link to a specific report.ˆà ˆà 13 In the following example, we rename the link to the Wiki start "Home", and make the "View Tickets" entry link to a specific report. The second example (below) also hides the "!Help/Guide" link.ˆà 17 14 ˆà 18 15 Relevant excerpt from the TracIni:ˆà òÀæ òÀæ ˆà 21 18 wiki.label = Homeˆà 22 19 tickets.href = /report/24ˆà ˆà 20 }}}ˆà 23 21 ˆà ˆà 22 === `[metanav]` #metanav-barˆà ˆà 23 `[metanav]` corresponds to the '''meta navigation bar''', by default positioned above the main navigation bar and below the ''Search'' box. It contains the ''Log in'', ''Logout'', ''!Help/Guide'' etc. entries. This navigation bar is meant to access some global information about the Trac project and the current user.ˆà ˆà 24 ˆà ˆà 25 There is one special entry in the `[metanav]` section: `logout.redirect` is the page the user sees after hitting the logout button. ˆà ˆà 26 [[comment(see also #Trac3808)]]ˆà ˆà 27 ˆà ˆà 28 ** Example ** ˆà ˆà 29 ˆà ˆà 30 {{{ˆà 24 31 [metanav]ˆà 25 32 help = disabledˆà ˆà 33 logout.redirect = wiki/Logoutˆà 26 34 }}}ˆà ˆà 35 ˆà ˆà 36 ˆà ˆà 37 === Notesˆà ˆà 38 Possible URL formats (for `.href` or `.redirect`):ˆà ˆà 39 || '''config''' || '''redirect to''' ||ˆà ˆà 40 || `wiki/Logout` || `/projects/env/wiki/Logout` ||ˆà ˆà 41 || `http://hostname/` || `http://hostname/` ||ˆà ˆà 42 || `/projects` || `/projects` ||ˆà ˆà 43 ˆà ˆà 44 ˆà ˆà 45 === `[trac]` #nav-orderˆà ˆà 46 The `mainnav` and `metanav` options in the `[trac]` configuration section control the order in which the navigation items are displayed (left to right). This can be useful with plugins that add navigation items.ˆà ˆà 47 ˆà ˆà 48 ** Example ** ˆà ˆà 49 ˆà ˆà 50 In the following example, we change the order to prioritise the ticket related items further left.ˆà ˆà 51 ˆà ˆà 52 Relevant excerpt from the TracIni:ˆà ˆà 53 {{{ˆà ˆà 54 [trac]ˆà ˆà 55 mainnav = wiki,tickets,newticket,timeline,roadmap,browser,search,adminˆà ˆà 56 }}}ˆà ˆà 57 ˆà ˆà 58 The default order and item names can be found in the source, which at the time of writing [source:trunk/trac/web/chrome.py@10883:397,402-403#L396 is here]ˆà ˆà 59 ˆà ˆà 60 === Context Navigation #ctxtnav-barˆà ˆà 61 ˆà ˆà 62 Note that it is still not possible to customize the '''contextual navigation bar''', i.e. the one usually placed below the main navigation bar.ˆà ˆà 63 ˆà 27 64 ˆà 28 65 ----ˆà