1 | #!/usr/bin/env python |
---|
2 | # -*- coding: utf-8 -*- |
---|
3 | # |
---|
4 | # Copyright (C) 2012-2013 MATOBA Akihiro <matobaa+trac-hacks@gmail.com> |
---|
5 | # All rights reserved. |
---|
6 | # |
---|
7 | # This software is licensed as described in the file COPYING, which |
---|
8 | # you should have received as part of this distribution. |
---|
9 | |
---|
10 | from trac.core import Component, implements |
---|
11 | from trac.web.api import ITemplateStreamFilter |
---|
12 | from trac.web.chrome import add_script, ITemplateProvider |
---|
13 | from pkg_resources import ResourceManager |
---|
14 | |
---|
15 | |
---|
16 | class Checkbox(Component): |
---|
17 | """at query when |
---|
18 | double-click a checkbox clears neighbor checkboxes and check it. |
---|
19 | double-click a label at left of checkboxes flips checked or not. """ |
---|
20 | |
---|
21 | implements(ITemplateProvider, ITemplateStreamFilter) |
---|
22 | |
---|
23 | #ITemplateStreamFilter methods |
---|
24 | def filter_stream(self, req, method, filename, stream, data): |
---|
25 | if filename == 'query.html': |
---|
26 | add_script(req, 'querystatushelper/js/enabler.js') |
---|
27 | return stream |
---|
28 | |
---|
29 | # ITemplateProvider methods |
---|
30 | def get_htdocs_dirs(self): |
---|
31 | return [('querystatushelper', ResourceManager().resource_filename(__name__, 'htdocs'))] |
---|
32 | |
---|
33 | def get_templates_dirs(self): |
---|
34 | return [] |
---|