Changes between Version 3 and Version 4 of TracInterfaceCustomization
- Timestamp:
- May 24, 2018, 4:29:30 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracInterfaceCustomization
v3 v4 1 1 = Customizing the Trac Interface 2 3 2 [[TracGuideToc]] 4 3 [[PageOutline(2-5,Contents,pullout)]] … … 7 6 8 7 == Project Logo and Icon 9 10 8 The easiest parts of the Trac interface to customize are the logo and the site icon. Both of these can be configured with settings in [wiki:TracIni trac.ini]. 11 9 … … 17 15 18 16 === Logo 19 20 17 Change the `src` setting to `site/` followed by the name of your image file. The `width` and `height` settings should be modified to match your image's dimensions. The Trac chrome handler uses `site/` for files within the project directory `htdocs`, and `common/` for the common `htdocs` directory belonging to a Trac installation. Note that 'site/' is not a placeholder for your project name, it is the literal prefix that should be used. For example, if your project is named 'sandbox', and the image file is 'red_logo.gif' then the 'src' setting would be 'site/red_logo.gif', not 'sandbox/red_logo.gif'. 21 18 … … 29 26 30 27 === Icon 31 32 28 Icons are small images displayed by your web browser next to the site's URL and in the `Bookmarks` menu. Icons should be a 32x32 image in `.gif` or `.ico` format. Change the `icon` setting to `site/` followed by the name of your icon file: 33 29 … … 38 34 39 35 == Custom Navigation Entries 40 41 36 The new [mainnav] and [metanav] can now be used to customize the text and link used for the navigation items, or even to disable them, but not for adding new ones. 42 37 … … 94 89 {{{#!xml 95 90 <form py:match="div[@id='content' and @class='ticket']/form" py:attrs="select('@*')"> 96 <py:if test="req. environ['PATH_INFO']== '/newticket' and (not 'preview' in req.args)">91 <py:if test="req.path_info == '/newticket' and (not 'preview' in req.args)"> 97 92 <p>Please make sure to search for existing tickets before reporting a new one!</p> 98 93 </py:if> … … 101 96 }}} 102 97 103 This example illustrates a technique of using `req. environ['PATH_INFO']` to limit scope of changes to one view only. For instance, to make changes in `site.html` only for timeline and avoid modifying other sections - use `req.environ['PATH_INFO']== '/timeline'` condition in `<py:if>` test.98 This example illustrates a technique of using `req.path_info` to limit scope of changes to one view only. For instance, to make changes in `site.html` only for timeline and avoid modifying other sections - use `req.path_info == '/timeline'` condition in `<py:if>` test. 104 99 105 100 More examples snippets for `site.html` can be found at [trac:wiki:CookBook/SiteHtml CookBook/SiteHtml]. … … 107 102 Example snippets for `style.css` can be found at [trac:wiki:CookBook/SiteStyleCss CookBook/SiteStyleCss]. 108 103 109 If the environment is upgraded from 0.10 and a `site_newticket.cs` file already exists, it can be loaded using a workaround, provided it contains no [trac:ClearSilver] processing. In addition, as only one element can be imported, the content needs a wrapper, such as a `<div>` block or other similar parent container. The XInclude namespace must be specified to allow includes, but that can be moved to document root along with the others: 110 {{{#!xml 111 <form py:match="div[@id='content' and @class='ticket']/form" py:attrs="select('@*')" 112 xmlns:xi="http://www.w3.org/2001/XInclude"> 113 <py:if test="req.environ['PATH_INFO'] == '/newticket' and (not 'preview' in req.args)"> 114 <xi:include href="site_newticket.cs"><xi:fallback /></xi:include> 115 </py:if> 116 ${select('*')} 117 </form> 118 }}} 119 120 Also note that the `site.html`, despite its name, can be put in a shared templates directory, see the [[TracIni#inherit-section|[inherit] templates_dir]] option. This could provide easier maintenance (and a migration path from 0.10 for larger installations) as one new global `site.html` file can be made to include any existing header, footer and newticket snippets. 104 Note that the `site.html`, despite its name, can be put in a shared templates directory, see the [[TracIni#inherit-section|[inherit] templates_dir]] option. This could provide easier maintainence as one new global `site.html` file can be made to include any existing header, footer and newticket snippets. 121 105 122 106 == Project List #ProjectList