With default template, trac ticket is available for viewing only, I must click modify to expand properties tab to modify, change state of a ticket. Now I want to expand that tab automatically? How can I change it quickly without changing the template itself? Is it possible to change it with trac.ini file? I cannot find where's location of default template to change, so I cannot change myself. Thanks!
-
I have exactly the same need - even some help with how to change the template would be useful. – Tom Jul 27 '10 at 12:17
-
Are you two talking about trac 0.12? IF so, it would probably be good to add that information to the question. I don't have any "Modify" tab in trac 0.11. Actually, I don't have any tabs on the ticket at all... – Oliver Giesen Jul 27 '10 at 12:46
-
yes, I'm using Trac 0.12 – hungnv Jul 29 '10 at 06:40
3 Answers
I think the best way to enable the behavior you're looking for is to add a custom JS file (which can be injected much like a custom CSS, read TracInterfaceCustomization).
In that file do this:
$(document).ready(function() {
window.setTimeout(function() {
$("#modify").parent().removeClass('collapsed')
}, 0);
});
This code is untested but it should give you the idea. Basically we need to wait until the DOM is ready ($(document).ready) but as there are multiple JS functions called during that event, the setTimeOut sets a slight delay to make sure that the collapse command went through before.
HTH from a professional Trac developer :-)

- 2,938
- 4
- 28
- 41
-
1I had to use $(document).ready to get this to work, but other than that worked great in trac 0.12. Thanks! – icco Sep 07 '10 at 01:10
-
I've tried this numerous times, and couldn't for the life of me get it to work, I even responded to this Question and then deleted it after I realized my false assumption I made. icco's result is the same as mine, change the first line from `$.ready` to `$(document).ready`, AND IT WORKS! YAY! Now to get the TRAC developers to undo this horrible change in the webapp itself. I cannot even fathom the assumption they made in the first place. – VxJasonxV Sep 11 '10 at 23:31
-
yes, you're right I forgot the $(document).ready, changed that :-) – Felix Schwarz Sep 19 '10 at 13:48
I'm using trac 0.12 and had the same issue.
...without changing the template itself
I couldn't find a option to configure it but I did notice if you click the "modify" quick link at the top right of the ticket then the "Modify Ticket" foldable area is automatically uncollapsed for you.
I know you didn't ask for it, but just in case, you want a horrible template hack...
Open the template file in editor, e.g. for me in CentOS 5.5:
sudo emacs /usr/lib/python2.4/site-packages/Trac-0.12-py2.4.egg/trac/ticket/templates/ticket.html
Comment out the jQuery line that triggers the modify section to collapse on page ready:
//$("#modify").parent().toggleClass("collapsed");
I found the edit didn't take effect straight away - perhaps the template is cached or something? It worked after a few minutes of shift-refreshing and restarting apache.
Lets hope someone else answers with a better solution...

- 14,041
- 16
- 64
- 80
-
1yes, templates are cached. you need to set [trac] auto_reload = True in your trac.ini – Felix Schwarz Jul 27 '10 at 19:47
-
But for me, the directory you're talking about /usr/lib/python2.4/site-packages/Trac-0.12-py2.4.egg is just a file with egg extension? It's so strange with me, this's first time I use Trac, why your directory becomes my file with same version of Trac? – hungnv Jul 29 '10 at 06:58
-
1Your egg is zipped whereas mine is unzipped. I installed Trac using `easy_install --always-unzip Trac==0.12` because my OS can't recognise zipped eggs. You could unzip your egg using `unzip`, then remove the zipped version (otherwise you'll have two tracs installed). – Tom Jul 29 '10 at 10:56
This is basically Schwarz's answer but in a simpler form
To get ticket contols expanded on load do following. Put following code
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
py:strip="">
<!--! Add site-specific style sheet -->
<head py:match="head" py:attrs="select('@*')">
${select('*|comment()|text()')}
<script type="text/JavaScript">
<!--
// EXPAND TICKET CONROLS ON LOAD.
jQuery(document).ready(function() {
window.setTimeout(function() {
$("#modify").parent().removeClass('collapsed')
}, 1);
});
//-->
</script>
</head>
<body py:match="body" py:attrs="select('@*')">
${select('*|text()')}
</body>
</html>
in /path/to/your/trac/project/templates directory in file site.html.

- 7,000
- 7
- 36
- 37