[Trac-tickets] [The Trac Project] #2780: ShowPath integration into
Trac
The Trac Project
noreply at edgewall.com
Mon Feb 20 08:04:20 CST 2006
#2780: ShowPath integration into Trac
-------------------------+--------------------------------------------------
Reporter: cmarschalek | Owner: jonas
Type: enhancement | Status: new
Priority: low | Milestone:
Component: wiki | Version: 0.9.4
Severity: trivial | Keywords: showpath, wiki
-------------------------+--------------------------------------------------
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
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2780>
The Trac Project <http://trac.edgewall.com/>
More information about the Trac-Tickets
mailing list