source: timingandestimationplugin/branches/trac1.0/timingandestimationplugin/ticket_webui.py

Last change on this file was 14061, checked in by Russ Tyndall, 9 years ago

branched for trac1.0

File size: 1.6 KB
RevLine 
[1516]1from trac.core import *
[12821]2from trac.web.api import IRequestFilter
3from trac.web.chrome import add_script
[1516]4
[4874]5
[12821]6class BetterHoursDisplay(Component):
7    """This component changes decimal hours to hours/minutes"""
8    implements(IRequestFilter)
9    def pre_process_request(self, req, handler):
10        return handler
[1516]11
[12821]12    def post_process_request(self, req, template, data, content_type):
13        if template == 'ticket.html':
14            add_script(req, "billing/ticket.js")
15        return (template, data, content_type)
16
17class HoursLayoutChanger(Component):
18    """This moves the add hours box up to underneath the comment box.
19    Removes the add_hours field from the ticket properties display
20    and then cleans up these tables
21
22    This prevents needing to expand the "Modify Ticket" section to
23    add hours and a comment
24    """
25    implements(IRequestFilter)
26    def pre_process_request(self, req, handler):
27        return handler
28
29    def post_process_request(self, req, template, data, content_type):
30        if template == 'ticket.html':
31            add_script(req, "billing/change_layout.js")
32        return (template, data, content_type)
33
34
35class AddHoursSinceComment(Component):
36    """Adds a button next to the changes in ticket history that fills
37    the Add Hours box with the time since that change"""
38    implements(IRequestFilter)
39    def pre_process_request(self, req, handler):
40        return handler
41
42    def post_process_request(self, req, template, data, content_type):
43        if template == 'ticket.html':
44            add_script(req, "billing/add_hours_from_comment.js")
45        return (template, data, content_type)
46
47
Note: See TracBrowser for help on using the repository browser.