Opened 9 years ago

Closed 9 years ago

#2422 closed defect (fixed)

[patch] Discussion shows ctxtnav x 2 with Trac 0.11b1

Reported by: Odd Simon Simonsen Owned by: Radek Bartoň
Priority: normal Component: DiscussionPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


Trac 0.11b1 now includes <div id="ctxtnav">... by default. As the plugin also adds it for its own needs, it lists twice - one is empty, the other with content. It may not show well on a default Trac (other than some extra white space), but with custom styling of navigation it becomes very obvious.

Here is a patch for adding the items through code instead:

  • (a) vs. (b) (clipboard)

    a b  
    55from trac.core import *
    66from trac.perm import PermissionError
    7 from import add_stylesheet, add_script
     7from import add_stylesheet, add_script, add_ctxtnav
    88from import format_to_html, format_to_oneliner
    99from trac.util.datefmt import to_timestamp, to_datetime, utc, \
    1010  format_datetime, pretty_timedelta
    8585['mode'] = modes[-1]
    8686['time'] = format_datetime(
    8787['realm'] = context.resource.realm
     89        # Add Context Navigation.
     90        if forum:
     91            add_ctxtnav(context.req, 'Forum Index',
     92                    href=context.req.href.discussion())
     93        if topic:
     94            add_ctxtnav(context.req, forum['subject'],
     95                    href=context.req.href.discussion(forum['id']))
     96        if message:
     97            add_ctxtnav(context.req, topic['subject'],
     98                    href=context.req.href.discussion(forum['id'], topic['id']))
    89100        # Add CSS styles and scripts.
    90101        add_stylesheet(context.req, 'common/css/wiki.css')

When that is implemented, it is just a matter of removing all the

<xi:include href="wiki-discussion-header.html"/>
lines in all the templates, and removing the discussion-header.html from the project as it is no longer needed as far as i can tell.

Attachments (0)

Change History (1)

comment:1 Changed 9 years ago by Radek Bartoň

Resolution: fixed
Status: newclosed

Thanks, finally Trac has common mechanism for context navigation. I have applied patch to source.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Radek Bartoň.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.