Opened 19 years ago
Closed 16 years ago
#2780 closed enhancement (fixed)
ShowPath integration into Trac
Reported by: | cmarschalek | Owned by: | Remy Blank |
---|---|---|---|
Priority: | normal | Milestone: | 0.11.2 |
Component: | wiki system | Version: | devel |
Severity: | normal | Keywords: | showpath wiki patch |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
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
Attachments (2)
Change History (27)
comment:1 by , 19 years ago
Priority: | low → normal |
---|---|
Version: | 0.9.4 → 0.9.5 |
comment:2 by , 19 years ago
Version: | 0.9.5 → devel |
---|
comment:3 by , 18 years ago
comment:4 by , 18 years ago
Milestone: | → 0.9.7 |
---|
comment:5 by , 18 years ago
Milestone: | 0.9.7 |
---|
Milestone 0.9.7 is for bug fixes only. This will not be added for that release.
comment:6 by , 18 years ago
Well, can you set another milestone (or close it) then? It would be nice to finally find out what you guys think about this enhancement :) Tia!
comment:8 by , 18 years ago
Milestone: | → 0.10 |
---|
comment:9 by , 18 years ago
Milestone: | 0.10 |
---|
We're feature-freezing 0.10, so this isn't going in now.
comment:12 by , 18 years ago
Replying to markus:
I'd like to see it too coming with 0.10…
As cmlenz said, this will not be going into 0.10. We need to lock down the feature set so we can work out some remaining bugs and push out the release.
comment:13 by , 18 years ago
You should be able to do this quite easily in 0.11 using PageTemplates. See r3881 and #962 for more details.
You'll just need to add a PageTemplates/DefaultPage with the macro in it.
comment:14 by , 18 years ago
Resolution: | → duplicate |
---|---|
Severity: | trivial → minor |
Status: | new → closed |
See #4423, which discusses how to solve this in a generic way.
follow-up: 19 comment:15 by , 18 years ago
Milestone: | → 0.11 |
---|---|
Resolution: | duplicate |
Severity: | minor → normal |
Status: | closed → reopened |
I'll add the hierarchical path information, similar to what we have for the repository browser. Related to #4507.
comment:17 by , 17 years ago
For 0.10.4 change:
prefix = Markup(page.name)
to
prefix = page.name
and this will work — not sure the implications, but that did the trick for me.
Also slap some css in share\trac\htdocs\css\trac.css
div.wikinav { position: absolute; top: 117px; left: 10px; color: #999; text-transform: lowercase; display: block; }
Adjust CSS for positioning as needed.
comment:18 by , 17 years ago
I took the version on MacroBazaar, which wasn't quite right, fixed it up, and put it on Trac Hacks at th:wiki:ShowPathPlugin.
by , 16 years ago
Attachment: | 2780-wiki-show-path-r7470.patch added |
---|
Patch against 0.11-stable showing the path of hierarchical wiki pages
comment:19 by , 16 years ago
Keywords: | patch added |
---|---|
Owner: | changed from | to
Status: | reopened → new |
Replying to cboos:
I'll add the hierarchical path information, similar to what we have for the repository browser.
The patch above adds clickable path information to the top of hierarchical wiki pages. The path is not shown for non-hierarchical pages.
Questions:
- The style has been borrowed directly from the repository browser. It is relatively close to the style of first-level wiki titles, except for the color. Should it be made more differentiated?
- Should this functionality be made configurable?
Comments?
follow-up: 21 comment:20 by , 16 years ago
The style should be a css class which can be customized when needed (imho) ;)
follow-up: 22 comment:21 by , 16 years ago
Replying to cmarschalek:
The style should be a css class which can be customized when needed (imho) ;)
If you look at the patch, you'll see that it is a set of CSS classes.
follow-up: 23 comment:22 by , 16 years ago
Replying to rblank:
Replying to cmarschalek:
The style should be a css class which can be customized when needed (imho) ;)
If you look at the patch, you'll see that it is a set of CSS classes.
"Should this functionality be made configurable? "
Did you mean the overall functionality of showing the breadcrumbs then? If so, imho, this doesn't need to be configurable (like I said before a wiki should have some default way of navigation). I'm certain though, that at least someone will not like such feature, but looking at the patch (yes, now I did;) it should be quite easy to remove…
comment:23 by , 16 years ago
Replying to cmarschalek:
Did you mean the overall functionality of showing the breadcrumbs then?
Yes, that's what I meant. Sorry for not being clear.
Please note though that this patch doesn't implement breadcrumbs, but shows the path for pages that have a hierarchical structure (i.e. contain a '/'). Breadcrumbs are a list of the most recently visited items. There's a plugin for that: th:BreadCrumbsNavPlugin.
comment:24 by , 16 years ago
Milestone: | 0.11.3 → 0.11.2 |
---|
Well for hierachical data the recently visited items is the path ;) Anyway this "path" is what I ment with breadcrumbs in lack of a better term…
How about letting this in into 0.11.2?
any news on this?