Ticket #2780 (closed enhancement: fixed)
ShowPath integration into Trac
| Reported by: | cmarschalek | Owned by: | rblank |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.11.2 |
| Component: | wiki system | Version: | devel |
| Severity: | normal | Keywords: | showpath wiki patch |
| Cc: |
Description
I'd like to see bread-crumb-navigation for the wiki.
I adapted the ShowPath? Trac hack (http://trac-hacks.org/wiki/TracShowPathPatch) to 0.9.3. As I'm not very capable with Python, instead of a diff, here's what needs to be changed:
Python Source
The following code needs to be added to "wiki/web_ui.py":
prefix = Markup(page.name)
heirarchy = prefix.split('/')
if len(heirarchy) > 1 or heirarchy[0] != 'WikiStart':
req.hdf.setValue('wiki.page_parent.node_count', '%s' % len(heirarchy))
for i in range(len(heirarchy)):
req.hdf.setValue('wiki.page_parent.node.%d' % i, heirarchy[i])
Inbetween
req.hdf['wiki.action'] = action
req.hdf['wiki.page_name'] = page.name
req.hdf['wiki.current_href'] = self.env.href.wiki(page.name)
and
return 'wiki.cs', None
The linenumber in 0.9.3, for the text above, is 120...
CSS
The wiki template (wiki.cs) hast to be changed too:
This line
<li><a href="<?cs var:trac.href.wiki ?>">Start Page</a></li>
has to be replaced with this
<div class="wikinav"> >> <a href="<?cs var:$trac.href.wiki ?>">Start Page</a> <?cs set:node_href = trac.href.wiki ?><?cs set:node_max = wiki.page_parent.node_count - 1 ?> <?cs each:node = wiki.page_parent.node ?> <?cs set:node_href = node_href + '/' + node ?> > <?cs if:node_max == name(node) ?><?cs var:node ?> <?cs else ?><a href="<?cs var:node_href ?>"><?cs var:node ?></a><?cs /if ?><?cs /each ?> </div>
The wikinav class has to be defined in the default css too.
I hope this simple change can be integrated into trac :)
c.marschalek@[-remove-me-]schrack-seconet.com


