Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Trac: Users

How to add button in Ticket.html

 

 

Trac users RSS feed   Index | Next | Previous | View Threaded


dkuttiyappan at atxg

Oct 9, 2008, 12:25 PM

Post #1 of 5 (162 views)
Permalink
How to add button in Ticket.html

I wanted to add a button next to change history, so that when I click it expands the change history log.
By default - Collapse all. This feature is a part of ticket# 7640

As a first step:
I added a (JS hackery) button inside ticket.html using viewsource of the html.
File location - \trac\ticket\templates\ticket.html

Changes:
<py:if test="ticket.exists and changes">
<h2>Change History</h2>
<div id="mydiv" style="display:none">
<h3>This is a test!<br>Can you see me?
</h3></div>
<a href="javascript:;" onmousedown="if(document.getElementById('mydiv').style.display == 'none')
{ document.getElementById('mydiv').style.display = 'block'; } else
{ document.getElementById('mydiv').style.display = 'none'; }">Toggle Div Visibility</a>

My next step is to setup the stream filter inside this JavaScript button.

Issue:
When I load trac, I could not able to see the modifications I did in ticket.html.
But when I manually see the ticket html page (going through trac\ticket\templates\ticket.html), I could see my changes.

Am I doing anything wrong?

Please help me to add a button next to change history and have my feature implemented.

Thanks,
Damu


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users[at]googlegroups.com
To unsubscribe from this group, send email to trac-users+unsubscribe[at]googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---


noah at coderanger

Oct 9, 2008, 1:33 PM

Post #2 of 5 (153 views)
Permalink
Re: How to add button in Ticket.html [In reply to]

Either restart the server or enabled auto_reload in trac.ini (template
reloading).



--Noah



From: trac-users[at]googlegroups.com [mailto:trac-users[at]googlegroups.com] On
Behalf Of Kuttiyappan, Damodharan (CONTRACTOR)
Sent: Thursday, October 09, 2008 12:25 PM
To: trac-users[at]googlegroups.com
Subject: [Trac] How to add button in Ticket.html





I wanted to add a button next to change history, so that when I click it
expands the change history log.

By default - Collapse all. This feature is a part of ticket# 7640



As a first step:

I added a (JS hackery) button inside ticket.html using viewsource of the
html.

File location - \trac\ticket\templates\ticket.html



Changes:

<py:if test="ticket.exists and changes">

<h2>Change History</h2>

<div id="mydiv" style="display:none">

<h3>This is a test!<br>Can you see me?

</h3></div>

<a href="javascript:;"
onmousedown="if(document.getElementById('mydiv').style.display == 'none')

{ document.getElementById('mydiv').style.display = 'block'; } else

{ document.getElementById('mydiv').style.display = 'none';
}">Toggle Div Visibility</a>



My next step is to setup the stream filter inside this JavaScript button.



Issue:

When I load trac, I could not able to see the modifications I did in
ticket.html.

But when I manually see the ticket html page (going through
trac\ticket\templates\ticket.html), I could see my changes.



Am I doing anything wrong?



Please help me to add a button next to change history and have my feature
implemented.



Thanks,

Damu








--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users[at]googlegroups.com
To unsubscribe from this group, send email to trac-users+unsubscribe[at]googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---


dkuttiyappan at atxg

Oct 9, 2008, 1:46 PM

Post #3 of 5 (154 views)
Permalink
Re: How to add button in Ticket.html [In reply to]

Even after restarting the server, I could not able to see the changes.

I there any other place we need to make the changes like in web_ui.py

Thanks,
Damu

________________________________
From: trac-users[at]googlegroups.com [mailto:trac-users[at]googlegroups.com] On Behalf Of Noah Kantrowitz
Sent: Thursday, October 09, 2008 3:34 PM
To: trac-users[at]googlegroups.com
Subject: [Trac] Re: How to add button in Ticket.html

Either restart the server or enabled auto_reload in trac.ini (template reloading).

--Noah

From: trac-users[at]googlegroups.com [mailto:trac-users[at]googlegroups.com] On Behalf Of Kuttiyappan, Damodharan (CONTRACTOR)
Sent: Thursday, October 09, 2008 12:25 PM
To: trac-users[at]googlegroups.com
Subject: [Trac] How to add button in Ticket.html


I wanted to add a button next to change history, so that when I click it expands the change history log.
By default - Collapse all. This feature is a part of ticket# 7640

As a first step:
I added a (JS hackery) button inside ticket.html using viewsource of the html.
File location - \trac\ticket\templates\ticket.html

Changes:
<py:if test="ticket.exists and changes">
<h2>Change History</h2>
<div id="mydiv" style="display:none">
<h3>This is a test!<br>Can you see me?
</h3></div>
<a href="javascript:;" onmousedown="if(document.getElementById('mydiv').style.display == 'none')
{ document.getElementById('mydiv').style.display = 'block'; } else
{ document.getElementById('mydiv').style.display = 'none'; }">Toggle Div Visibility</a>

My next step is to setup the stream filter inside this JavaScript button.

Issue:
When I load trac, I could not able to see the modifications I did in ticket.html.
But when I manually see the ticket html page (going through trac\ticket\templates\ticket.html), I could see my changes.

Am I doing anything wrong?

Please help me to add a button next to change history and have my feature implemented.

Thanks,
Damu






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users[at]googlegroups.com
To unsubscribe from this group, send email to trac-users+unsubscribe[at]googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---


hyugaricdeau at gmail

Oct 10, 2008, 8:44 AM

Post #4 of 5 (141 views)
Permalink
Re: How to add button in Ticket.html [In reply to]

On Thu, Oct 9, 2008 at 4:46 PM, Kuttiyappan, Damodharan (CONTRACTOR)
<dkuttiyappan[at]atxg.com> wrote:
> Even after restarting the server, I could not able to see the changes.
>
> I there any other place we need to make the changes like in web_ui.py
>
> Thanks,
> Damu

No, you really shouldn't have to modify anything, in fact. This could
be done as a plugin that implements the IRequestFilter interface, and
uses that to include a JavaScript file on all requests to the ticket
module. The JavaScript itself could then insert your Hide/Show button
into the page's DOM and implement the functionality. This has the
added benefit that the link won't even be displayed for users not
using JavaScript (and therefore unable to use the feature anyways).
It also means that you won't have to re-implement your modifications
to the template every time you upgrade Trac.

See http://trac.edgewall.org/wiki/TracDev/PluginDevelopment for an
intro to Trac plugin development.

Your plugin basically needs to implement IRequestFilter to include the
JS file in requests, and the ITemplateProvider to provide the JS file
itself. Ask back if you have any more questions. Of course, if you
still want to go ahead with modifying the template, just modifying the
template file and restarting the web server should do it.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users[at]googlegroups.com
To unsubscribe from this group, send email to trac-users+unsubscribe[at]googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---


dkuttiyappan at atxg

Oct 10, 2008, 9:06 AM

Post #5 of 5 (140 views)
Permalink
Re: How to add button in Ticket.html [In reply to]

Thanks for your response.
I'm new to python and trac. I'm finding difficult to implement IRequestFilter to include the JS file in requests, and the ITemplateProvider to provide the JS file itself. As of now I won't upgrade my Trac. So the option of modifying ticket.html would be better for me.

Instead I modified the ticket.html in template by opening in notepad and editing it.
As a trial I just modified the name of change history to chage hitory. But the changes are not reflected.
I restarted the web server. I installed trac using Jumpbox. So I closed it and opened it again.
Yet I could not see the changes in my trac page.

Am I doing anything wrong?

Kindly help me to resolve it.

I'm looking forward to your reply.

Thanks,
Damu

-----Original Message-----
From: trac-users[at]googlegroups.com [mailto:trac-users[at]googlegroups.com] On Behalf Of Erik Bray
Sent: Friday, October 10, 2008 10:44 AM
To: trac-users[at]googlegroups.com
Subject: [Trac] Re: How to add button in Ticket.html


On Thu, Oct 9, 2008 at 4:46 PM, Kuttiyappan, Damodharan (CONTRACTOR)
<dkuttiyappan[at]atxg.com> wrote:
> Even after restarting the server, I could not able to see the changes.
>
> I there any other place we need to make the changes like in web_ui.py
>
> Thanks,
> Damu

No, you really shouldn't have to modify anything, in fact. This could
be done as a plugin that implements the IRequestFilter interface, and
uses that to include a JavaScript file on all requests to the ticket
module. The JavaScript itself could then insert your Hide/Show button
into the page's DOM and implement the functionality. This has the
added benefit that the link won't even be displayed for users not
using JavaScript (and therefore unable to use the feature anyways).
It also means that you won't have to re-implement your modifications
to the template every time you upgrade Trac.

See http://trac.edgewall.org/wiki/TracDev/PluginDevelopment for an
intro to Trac plugin development.

Your plugin basically needs to implement IRequestFilter to include the
JS file in requests, and the ITemplateProvider to provide the JS file
itself. Ask back if you have any more questions. Of course, if you
still want to go ahead with modifying the template, just modifying the
template file and restarting the web server should do it.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users[at]googlegroups.com
To unsubscribe from this group, send email to trac-users+unsubscribe[at]googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Trac users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.