Modify ↓
Opened 10 years ago
Closed 10 years ago
#12113 closed defect (fixed)
PATCH: javascript not added to ticket page when using custom theme
Reported by: | Cinc | Owned by: | falkb |
---|---|---|---|
Priority: | normal | Component: | SimpleMultiProjectPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.12 |
Description
Hi,
we are using a Trac installation with a custom theme which doesn't have a banner at the top. Because of that the javascript file for filtering the milestones can't be added to the ticket pages with the current code.
I created a patch which uses add_script()
instead of filtering to add the necessary script:
-
Trac/Plugins/SimpleMultiProject-0.0.4dev-py2.7.egg/simplemultiproject/ticket.py
88 88 89 89 def filter_stream(self, req, method, filename, stream, data): 90 90 if filename == "ticket.html": 91 add_script(req, "simplemultiproject/filter_milestones.js") 91 92 # replace "project" text input (lineedit) for ticket editing with a selection field 92 93 filter = Transformer('//input[@id="field-project"]') 93 94 ticket_data = data['ticket'] 94 95 95 script_filter = Transformer('//div[@id="banner"]')96 97 96 stream = stream | filter.replace(self._projects_field_ticket_input(req, ticket_data)) 98 stream = stream | script_filter.before(self._update_milestones_script(req))99 97 100 98 return stream 101 99 102 def _update_milestones_script(self, req):103 script = tag.script(type="text/javascript", src=req.href.chrome("simplemultiproject", "filter_milestones.js"))104 return script105 100 106 101 def _add_milestones_maps(self, req, ticket_data): 107 102
Works like a charm over here.
Regards Cinc
Attachments (1)
Change History (4)
Changed 10 years ago by
Attachment: | SimpleMultiProject_ticket.diff added |
---|
comment:1 Changed 10 years ago by
Thank you! I've applied the patch to the local system here without seeing any problems. Gonna test it on another system soon... stay tuned!
comment:2 Changed 10 years ago by
Status: | new → accepted |
---|
Note: See
TracTickets for help on using
tickets.
Patch for using add_script() when adding javascript to ticket page