customizing trac

April 25th, 2006

trac is a lightweight, web based (software) project management tool. it includes a wiki, a ticketing/bug tracking system and a subversion browser.

i’m using trac for several projects, and am pretty happy with it. just one thing has always bothered me: after creating a new ticket, i usually want to get back to my favourite tickets report (in my case show active tickets grouped by priority). in the standard trac configuration, i have to click on view tickets in the main menu and then click on the correct report - way too much work after you’ve done it 1000 times.

so here is how to add your favourite ticket report to trac’s main menu:

  • locate a file called header.cs, you can find it in trac’s template folder. on debian this is /usr/share/trac/templates/
  • find out the id of the report you want to link to, it’s the number in the report url. in this example http://domain.com/trac/report/2 the report id is 2
  • copy it to <your trac instance>/templates
  • open it and look for <div id="mainnav">
  • this div contains all the links in the main menu
  • add the following code where you want your report link to appear:
    call:navlink("My Ticket Report", trac.href.report+"/2", ticket_view, trac.acl.REPORT_VIEW, "") ?>
  • replace 2 with your report id
  • that’s it.


Tags: