Edgewall Software

Ticket #2780 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 weeks ago

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

Attachments

showpath-r3717.diff (1.6 kB) - added by anonymous 2 years ago.
showpath patch updated to the trunk r3717
2780-wiki-show-path-r7470.patch (1.2 kB) - added by rblank 7 weeks ago.
Patch against 0.11-stable showing the path of hierarchical wiki pages

Change History

  Changed 2 years ago by anonymous

  • priority changed from low to normal
  • version changed from 0.9.4 to 0.9.5

  Changed 2 years ago by anonymous

  • version changed from 0.9.5 to devel

  Changed 2 years ago by anonymous

any news on this?

  Changed 2 years ago by anonymous

  • milestone set to 0.9.7

  Changed 2 years ago by mgood

  • milestone 0.9.7 deleted

Milestone 0.9.7 is for bug fixes only. This will not be added for that release.

  Changed 2 years ago by cmarschalek

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!

  Changed 2 years ago by sgrayban@…

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

  Changed 2 years ago by anonymous

  • milestone set to 0.10

  Changed 2 years ago by cmlenz

  • milestone 0.10 deleted

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

  Changed 2 years ago by anonymous

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

follow-up: ↓ 12   Changed 2 years ago by markus

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

Changed 2 years ago by anonymous

showpath patch updated to the trunk r3717

in reply to: ↑ 11   Changed 2 years ago by mgood

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.

  Changed 2 years ago by sid

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.

  Changed 20 months ago by cboos

  • status changed from new to closed
  • resolution set to duplicate
  • severity changed from trivial to minor

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

follow-up: ↓ 19   Changed 17 months ago by cboos

  • status changed from closed to reopened
  • resolution duplicate deleted
  • severity changed from minor to normal
  • milestone set to 0.11

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

  Changed 15 months ago by cmarschalek

Thanks, sounds great!

  Changed 11 months ago by anonymous

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.

  Changed 5 months ago by Jason Winnebeck <jpwasp@…>

I took the version on MacroBazaar, which wasn't quite right, fixed it up, and put it on Trac Hacks at th:wiki:ShowPathPlugin.

Changed 7 weeks ago by rblank

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

in reply to: ↑ 15   Changed 7 weeks ago by rblank

  • keywords showpath patch added; showpath, removed
  • owner changed from jonas to rblank
  • status changed from reopened to 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   Changed 7 weeks ago by cmarschalek

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

in reply to: ↑ 20 ; follow-up: ↓ 22   Changed 7 weeks ago by 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.

in reply to: ↑ 21 ; follow-up: ↓ 23   Changed 6 weeks ago by cmarschalek

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   Changed 6 weeks ago by anonymous

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.

  Changed 6 weeks ago by anonymous

  • milestone changed from 0.11.3 to 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?

  Changed 2 weeks ago by rblank

  • status changed from new to closed
  • resolution set to fixed

Patch applied in [7554].

Add/Change #2780 (ShowPath integration into Trac)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.