Modify

Opened 15 years ago

Closed 14 years ago

#5974 closed enhancement (duplicate)

"plugin" style addition

Reported by: gregmac Owned by: gregmac
Priority: normal Component: DuplicateTicketSearchPlugin
Severity: normal Keywords:
Cc: mendoza@… Trac Release: 0.11

Description

Also to run this as a plugin, I did something like this:

/var/www/trac/plugins/duplicateticketsearch.py:

"""
DuplicateTicketSearch:
a plugin for Trac
http://trac.edgewall.org
"""

from genshi.filters.transform import Transformer

from pkg_resources import resource_filename

from trac.core import *
from trac.mimeview import Context
from trac.web.api import ITemplateStreamFilter
from trac.web.chrome import add_script
from trac.web.chrome import add_stylesheet
from trac.web.chrome import ITemplateProvider

class DuplicateTicketSearch(Component):

    implements(ITemplateStreamFilter, ITemplateProvider)

    ### method for ITemplateStreamFilter

    """Filter a Genshi event stream prior to rendering."""

    def filter_stream(self, req, method, filename, stream, data):
        if filename.endswith('ticket.html'):

            add_stylesheet(req, 'duplicateticketsearch/css/tracDupeSearch.css')
            add_script(req, 'duplicateticketsearch/js/tracDupeSearch.js')
        return stream

    ### methods for ITemplateProvider

    def get_htdocs_dirs(self):
        return [('duplicateticketsearch', resource_filename(__name__, 'htdocs'))]


    def get_templates_dirs(self):
        """Return a list of directories containing the provided template
        files.
        """
        return []

and then copied the .js and .css file to /var/www/trac/plugins/htdocs/js and /var/www/trac/plugins/htdocs/css

Not optimal, but a step closer I guess ;)

Attachments (0)

Change History (2)

comment:1 Changed 15 years ago by Ryan J Ollos

See also #6556.

comment:2 Changed 14 years ago by gregmac

Resolution: duplicate
Status: newclosed

See #6963

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain gregmac.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.