Edgewall Software

Changes between Version 1 and Version 2 of 1.3/TracNavigation


Ignore:
Timestamp:
Apr 9, 2017, 5:06:47 AM (7 years ago)
Author:
Ryan J Ollos
Comment:

Document #11317.

Legend:

Unmodified
Added
Removed
Modified
  • 1.3/TracNavigation

    v1 v2  
    11= Trac Navigation
    22
    3 The main and meta navigation entries can be customized in some basic ways. The `[mainnav]` and `[metanav]` configuration sections can be used to customize the navigation item text and link, change the ordering of the navigation items, or even disable them.
     3The main and meta navigation entries can be customized in several ways. The `[mainnav]` and `[metanav]` configuration sections can be used to customize the navigation item text and link, change the ordering of the navigation items, disable them and add new ones.
     4
     5The primary attributes which can be customized are `href`, `label`, `order` and `permission`.
    46
    57=== `[mainnav]` #mainnav-bar
     
    911** [=#Example Example] **
    1012
    11 In the following example we rename the link to WikiStart //Home//, and make the //View Tickets// entry link to a specific report.
     13In the following example we rename the link to WikiStart //HOME//, and make the //View Tickets// entry link to a specific report.
    1214{{{#!ini
    1315[mainnav]
     
    1517tickets.href = /report/24
    1618}}}
     19
     20Note the entries on the main navigation are displayed in uppercase regardless of the casing of the `label`.
    1721
    1822=== `[metanav]` #metanav-bar
     
    3034}}}
    3135
     36=== Extra Navigation Entries #nav-extra-entries
     37
     38New navigation entries can be arbitrarily defined and added
     39to the navigation. A new entry can be defined by providing a name with value `enabled`. At a minimum, the `href` attribute should be specified to define a useful navigation entry. If the `label` attribute is not defined the entry's name will be used for the label.
     40
     41The following example creates two new navigation items, one named //MY REPORTS// and the other named //builds//. //My Reports// is only visible to users with `REPORT_VIEW` permission.
     42{{{#!ini
     43[mainnav]
     44myreports = enabled
     45myreports.href = /report/9
     46myreports.label = My Reports
     47myreports.permission = REPORT_VIEW
     48
     49[metanav]
     50builds = enabled
     51builds.href = https://travis-ci.org/edgewall/trac
     52}}}
     53
     54The entry names are always read as lowercase, as is the case for all keys in the trac.ini file due to the way the configuration parser is configured. If the example above used `BUILDS` rather than `builds` for the name, the entry would still be displayed as `builds`. Use the `label` attribute for case-sensitive customization of the navigation entry text.
     55
     56=== Relocating Entries #nav-relocating-entries
     57
     58Navigation entries provided by Trac and plugin can be moved from the meta navigation bar to the main navigation bar, and vise-versa. The entry should be defined in the desired category as if it was a new entry, but existing attributes of the navigation item will be preserved. For example, to move the //Admin// entry to the metanav and rename it to //Administration//:
     59{{{#!ini
     60[metanav]
     61admin = enabled
     62admin.label = Administration
     63}}}
    3264
    3365=== URL Formats
     
    6395}}}
    6496
     97=== Permissions #nav-permissions
     98The `permission` attribute controls the visibility of the navigation item on the navigation bar. This is mainly useful for new entries in the navigation bar. Note that it does not provide access control to the URL that the navigation item directs to, and cannot override permission checks done by Trac and plugins.
     99
     100For example, the //Roadmap// navigation item will only display for users with `ROADMAP_VIEW`. Adding the attribute `roadmap.permission = MILESTONE_VIEW` will require both `ROADMAP_VIEW` and `MILESTONE_VIEW` for the entry to be visible, but as noted will not provide access control for the `/roadmap` path. TracFineGrainedPermissions should be used for access control to modules provided by Trac and plugins.
     101
    65102=== Context Navigation #ctxtnav-bar
    66103
     
    68105
    69106----
    70 See also: TracInterfaceCustomization, and the [http://trac-hacks.org/wiki/NavAddPlugin TracHacks:NavAddPlugin] or [http://trac-hacks.org/wiki/MenusPlugin TracHacks:MenusPlugin] (still needed for adding entries)
     107See also: TracInterfaceCustomization