| 1 | = Interface Customization using site.html = |
| 2 | |
| 3 | 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: |
| 4 | |
| 5 | {{{ |
| 6 | #!xml |
| 7 | <html xmlns="http://www.w3.org/1999/xhtml" |
| 8 | xmlns:py="http://genshi.edgewall.org/" |
| 9 | xmlns:xi="http://www.w3.org/2001/XInclude" |
| 10 | py:strip=""> |
| 11 | |
| 12 | <!--! Add snippets here... --> |
| 13 | |
| 14 | </html> |
| 15 | }}} |
| 16 | |
| 17 | Rememebr, snippets are more useful if accompanied by a short description... |
| 18 | |
| 19 | == Quicksearch for tickets only == |
| 20 | |
| 21 | 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: |
| 22 | |
| 23 | {{{ |
| 24 | #!xml |
| 25 | <div py:match="body/div[@id='banner']/form[@id='search']/div" |
| 26 | py:attrs="select('@*')" once="true"> |
| 27 | ${select('*|text()|comment()')} |
| 28 | <input type="hidden" name="ticket" value="on"/> |
| 29 | </div> |
| 30 | }}} |
| 31 | |
| 32 | Explanation: It grabs the `<div/>` inside the quicksearch form into a new div, adding any atrributes 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. |