source: timingandestimationplugin/branches/trac0.12/timingandestimationplugin/ticket_webui.py

Last change on this file was 12821, checked in by Russ Tyndall, 11 years ago

major rewrite of much of the javascript this plugin uses to modernize it and fix some latent bugs

File size: 1.6 KB
Line 
1from trac.core import *
2from trac.web.api import IRequestFilter
3from trac.web.chrome import add_script
4
5
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
11
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.