Edgewall Software
Modify

Opened 18 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)

showpath-r3717.diff (1.6 KB ) - added by anonymous 18 years ago.
showpath patch updated to the trunk r3717
2780-wiki-show-path-r7470.patch (1.2 KB ) - added by Remy Blank 16 years ago.
Patch against 0.11-stable showing the path of hierarchical wiki pages

Download all attachments as: .zip

Change History (27)

comment:1 by anonymous, 18 years ago

Priority: lownormal
Version: 0.9.40.9.5

comment:2 by anonymous, 18 years ago

Version: 0.9.5devel

comment:3 by anonymous, 18 years ago

any news on this?

comment:4 by anonymous, 18 years ago

Milestone: 0.9.7

comment:5 by Matthew Good, 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 cmarschalek, 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:7 by sgrayban@…, 18 years ago

I added this patch by hand the to 0.10 trunk and it works just great.

comment:8 by anonymous, 18 years ago

Milestone: 0.10

comment:9 by Christopher Lenz, 18 years ago

Milestone: 0.10

We're feature-freezing 0.10, so this isn't going in now.

comment:10 by anonymous, 18 years ago

please don't ignore this feature. It is very useful.

comment:11 by markus, 18 years ago

I'd like to see it too coming with 0.10…

by anonymous, 18 years ago

Attachment: showpath-r3717.diff added

showpath patch updated to the trunk r3717

in reply to:  11 comment:12 by Matthew Good, 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 sid, 17 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 Christian Boos, 17 years ago

Resolution: duplicate
Severity: trivialminor
Status: newclosed

See #4423, which discusses how to solve this in a generic way.

comment:15 by Christian Boos, 17 years ago

Milestone: 0.11
Resolution: duplicate
Severity: minornormal
Status: closedreopened

I'll add the hierarchical path information, similar to what we have for the repository browser. Related to #4507.

comment:16 by cmarschalek, 17 years ago

Thanks, sounds great!

comment:17 by anonymous, 16 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 Jason Winnebeck <jpwasp@…>, 16 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 Remy Blank, 16 years ago

Patch against 0.11-stable showing the path of hierarchical wiki pages

in reply to:  15 comment:19 by Remy Blank, 16 years ago

Keywords: patch added
Owner: changed from Jonas Borgström to Remy Blank
Status: reopenednew

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?

comment:20 by cmarschalek, 16 years ago

The style should be a css class which can be customized when needed (imho) ;)

in reply to:  20 ; comment:21 by Remy Blank, 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.

in reply to:  21 ; comment:22 by cmarschalek, 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…

in reply to:  22 comment:23 by anonymous, 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 anonymous, 16 years ago

Milestone: 0.11.30.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?

comment:25 by Remy Blank, 16 years ago

Resolution: fixed
Status: newclosed

Patch applied in [7554].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.