Edgewall Software
Home
Trac
Trac Hacks
Genshi
Babel
Bitten
Home
Download
Documentation
Mailing Lists
License
FAQ
Search:
Login
Preferences
Help/Guide
About Trac
Wiki
Timeline
Roadmap
Browse Source
View Tickets
New Ticket
Search
Context Navigation
-1
Start Page
Index
History
Editing CookBook/SiteHtml/Genshi
Adjust edit area height:
8
12
16
20
24
28
32
36
40
Edit side-by-side
= Interface Customization using site.html = This page intends to collect useful snippets for inclusing in a project `site.html` file. Any snippet below is intended to be included inside the standard root element of the file: {{{ #!xml <html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://genshi.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude" py:strip=""> <!--! Add snippets here... --> </html> }}} Remember, snippets are more useful if accompanied by a short description... == Quicksearch for tickets only == When no search filters are provided, Trac searches using all filters. This snippets adds a filter to the quicksearch that restricts searches to tickets only by default - more can of course be added by user after initial search: {{{ #!xml <div py:match="body/div[@id='banner']/form[@id='search']/div" py:attrs="select('@*')" once="true"> ${select('*|text()|comment()')} <input type="hidden" name="ticket" value="on"/> </div> }}} Explanation: It grabs the `<div/>` inside the quicksearch form into a new div, adding any attributes of the old (though no attributes by default) and then inserts any content (elements, text and comments) that the old element had with the `${select()}` call. To this new (identical) div, a new `<input/>` element is added that provides a filter for ticket-only search. == Add licensing information when adding attachments == If adding attachments to your Trac site requires people to agree to some licensing, you can add the terms of the license on the "Add attachments" page as follows: {{{ #!xml <py:match path="form[@id='attachment']/div[@class='buttons']" once="true"> <p>By submitting a file here, you accept that we can do whatever we want with it, blah blah...</p> <div py:attrs="select('@*')"> ${select('*|comment()|text()')} </div> </py:match> }}} Explanation: This matches the `<div>` containing the submit buttons, adds a paragraph with the text at that location, then reconstructs the matched `<div>` with its initial content and attributes. == Rename Roadmaps header == If your team would prefer to see a different title instead of Roadmap, add the following code to your site.html and restart the server. Don't forget to edit trac.ini to [TracNavigation change the link title]. {{{ <span py:match="h1"> <py:if test="req.environ['PATH_INFO'] == '/roadmap'"> <h1>Open Milestones</h1> </py:if> </span> }}} == Replace footer == If you want to change the default footer, this snippet strips out the current one and puts in my own. Tested with 1.0.1. Apologies for the formatting. {{{ <!--! Replace standard footer with a site-specific footer --> <div id="footer" py:match="//div[@id='footer']" py:strip="True"> <div id="footer"> <hr /> <a id="tracpowered" href="http://www.tnky.ca/"><img src="http://www.tnky.ca/TAI_tag.jpg" style="border: none; height: 98px; width: 185px; " alt="TAI Powered" /></a> <p class="left">Base Software is <a href="/about"><strong>Trac 1.0.1</strong></a><br /> By Edgewall Software.</p> <p class="right">Visit Turnkey Automation at<br /><a href="http://www.tnky.ca/"> http://www.tnky.ca/</a></p> </div> </div> }}} ---- See also: TracInterfaceCustomization, SiteStyleCss
Note:
See
WikiFormatting
and
TracWiki
for help on editing wiki content.
Change information
Your email or username:
E-mail address and name can be saved in the
Preferences
Comment about this change (optional):
Note:
See
TracWiki
for help on using the wiki.