| 1 | Index: trac/ticket/web_ui.py |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- trac/ticket/web_ui.py (revision 7349) |
|---|
| 4 | +++ trac/ticket/web_ui.py (working copy) |
|---|
| 5 | @@ -26,7 +26,7 @@ |
|---|
| 6 | from genshi.builder import tag |
|---|
| 7 | |
|---|
| 8 | from trac.attachment import AttachmentModule |
|---|
| 9 | -from trac.config import BoolOption, Option, IntOption, _TRUE_VALUES |
|---|
| 10 | +from trac.config import BoolOption, Option, IntOption, ListOption, _TRUE_VALUES |
|---|
| 11 | from trac.core import * |
|---|
| 12 | from trac.mimeview.api import Mimeview, IContentConverter, Context |
|---|
| 13 | from trac.resource import Resource, get_resource_url, \ |
|---|
| 14 | @@ -105,6 +105,10 @@ |
|---|
| 15 | If set to 'default', this is equivalent to 'yes' for new environments |
|---|
| 16 | but keeps the old behavior for upgraded environments (i.e. 'no'). |
|---|
| 17 | (''since 0.11'').""") |
|---|
| 18 | + |
|---|
| 19 | + unlinked_fields = ListOption('ticket', 'unlinked_fields', |
|---|
| 20 | + default=['estimatedhours', 'hours', 'totalhours'], |
|---|
| 21 | + doc="fields to exclude from AutoQuery markup") |
|---|
| 22 | |
|---|
| 23 | # IContentConverter methods |
|---|
| 24 | |
|---|
| 25 | @@ -1029,6 +1033,14 @@ |
|---|
| 26 | for key in field_changes: |
|---|
| 27 | ticket[key] = field_changes[key]['new'] |
|---|
| 28 | |
|---|
| 29 | + def _query_link(self, req, name, value): |
|---|
| 30 | + """return a link to /query with the appropriate name and value""" |
|---|
| 31 | + query = req.href('query', **{name:value}) |
|---|
| 32 | + args = self.env.config.get('query', 'default_anonymous_query') |
|---|
| 33 | + if args: |
|---|
| 34 | + query = '%s&%s' % (query, args) |
|---|
| 35 | + return tag.a(value, href=query) |
|---|
| 36 | + |
|---|
| 37 | def _prepare_fields(self, req, ticket): |
|---|
| 38 | context = Context.from_request(req, ticket.resource) |
|---|
| 39 | fields = [] |
|---|
| 40 | @@ -1036,6 +1048,10 @@ |
|---|
| 41 | name = field['name'] |
|---|
| 42 | type_ = field['type'] |
|---|
| 43 | |
|---|
| 44 | + # enable a link to custom query for the field |
|---|
| 45 | + if name not in self.unlinked_fields: |
|---|
| 46 | + field['rendered'] = self._query_link(req, name, ticket[name]) |
|---|
| 47 | + |
|---|
| 48 | # per field settings |
|---|
| 49 | if name in ('summary', 'reporter', 'description', 'status', |
|---|
| 50 | 'resolution'): |
|---|
| 51 | @@ -1226,7 +1242,9 @@ |
|---|
| 52 | 'attachments': AttachmentModule(self.env).attachment_data(context), |
|---|
| 53 | 'action_controls': action_controls, |
|---|
| 54 | 'action': selected_action, |
|---|
| 55 | - 'change_preview': change_preview |
|---|
| 56 | + 'change_preview': change_preview, |
|---|
| 57 | + 'reporter_link': self._query_link(req, 'reporter', ticket['reporter']), |
|---|
| 58 | + 'owner_link': self._query_link(req, 'owner', ticket['owner']) |
|---|
| 59 | }) |
|---|
| 60 | |
|---|
| 61 | def rendered_changelog_entries(self, req, ticket, when=None): |
|---|
| 62 | Index: trac/ticket/templates/ticket.html |
|---|
| 63 | =================================================================== |
|---|
| 64 | --- trac/ticket/templates/ticket.html (revision 7349) |
|---|
| 65 | +++ trac/ticket/templates/ticket.html (working copy) |
|---|
| 66 | @@ -135,9 +135,9 @@ |
|---|
| 67 | not in ('type', 'owner')]"> |
|---|
| 68 | <tr> |
|---|
| 69 | <th id="h_reporter">Reported by:</th> |
|---|
| 70 | - <td headers="h_reporter" class="searchable">${authorinfo(ticket.reporter)}</td> |
|---|
| 71 | + <td headers="h_reporter" class="searchable">${reporter_link}</td> |
|---|
| 72 | <th id="h_owner">Owned by:</th> |
|---|
| 73 | - <td headers="h_owner">${ticket.owner and authorinfo(ticket.owner) or ''} |
|---|
| 74 | + <td headers="h_owner">${owner_link} |
|---|
| 75 | </td> |
|---|
| 76 | </tr> |
|---|
| 77 | <tr py:for="row in group(fields, 2, lambda f: f.type != 'textarea')" |
|---|