tags:

views:

421

answers:

3

We use hosted Trac. It uses Genshi templates. I think we can submit our own site.html. We want to get rid of Trac standard footer. What is the most elegant way of doing that?

I suspect that the answer is in some nice Genshi trick. I don't know Genshi nor Trac's additions to it. I tried couple of things on a hunch, none worked.

I tried css

 <style type="text/css">
     #footer 
     {
         visibility:hidden;
     }
 </style>

That is ok, unless you want to use your own footer (called "#sitefooter"). This one comes after "#footer", and hiding footer leaves an ugly white space.

Then I tried jquery:

<script>
 jQuery(document).ready(function($) { $("#footer").text(''); });
</script>

This is fine yet I am not sure how wide support for jquery really is.

A: 

I don't have a recent copy of trac on me at present to poke into as far as templates go, but for CSS, you want to try

display: none;
margin: 0;
padding: 0;

instead of

visibility:hidden;

visibility hidden items still take up space.

Kent Fredric
margin and padding are probably superfluous.
Kent Fredric
css seems a more standard way of not displaying something then DOM manipulation in javascript. I still regret not being able to do it on the server side with some Genshi magic.
Michael
Better to use Marcin's updated method below as it is the official Trac manner of overriding site elements.
Eddie
+1  A: 

The most elegant way is to just change it in trac.ini. The footer is set in in trac.ini, and this is the default:

[project]
footer = Visit the Trac open source project at<br /><a href="http://trac.edgewall.org/"&gt;http://trac.edgewall.org/&lt;/a&gt;
marcin
This does not eleminate the whole of the footer, just the text line on the right hand side of the footer.
Michael
right, sorry for incorrect answer,to remove the footer completely you can add this to site.html (I tested it on ver. 0.12 from svn): <div py:match="div[@id='footer']"></div>
marcin
+2  A: 

Most elegant way is to modify site.html under

/path-to-trac/projectname/templates/

Example site.html file:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://genshi.edgewall.org/" py:strip="">
<!--! Custom match templates go here -->
<div py:match="div[@id='footer']">
    <!-- put custom footer markup here -->
</div>
</html>

Credit to marcin.

Ben Aston
you should include the id="footer" in the code above if you want to keep formatting but change values, like adding visitor tracking.<div py:match="div[@id='footer']" id="footer">
Eddie