# HG changeset patch
# Parent 7154aa4a3de9f58067459bc8789c9da5c5d85af6
#9604: add a link to the last query and to a new custom query at the top of the list of reports.
The first link leads to the saved query if there's one (that can be a report or a custom query), the second goes to a new custom query.
diff -r 7154aa4a3de9 trac/ticket/query.py
|
a
|
b
|
class QueryModule(Component): |
| 1067 | 1067 | self.env.is_component_enabled(ReportModule): |
| 1068 | 1068 | data['report_href'] = req.href.report() |
| 1069 | 1069 | add_ctxtnav(req, _('Available Reports'), req.href.report()) |
| 1070 | | add_ctxtnav(req, _('Custom Query')) |
| | 1070 | add_ctxtnav(req, _('Custom Query'), req.href.query()) |
| 1071 | 1071 | if query.id: |
| 1072 | 1072 | cursor = db.cursor() |
| 1073 | 1073 | cursor.execute("SELECT title,description FROM report " |
diff -r 7154aa4a3de9 trac/ticket/report.py
|
a
|
b
|
class ReportModule(Component): |
| 132 | 132 | self.env.is_component_enabled(QueryModule): |
| 133 | 133 | add_ctxtnav(req, _('Custom Query'), href=req.href.query()) |
| 134 | 134 | data['query_href'] = req.href.query() |
| | 135 | data['saved_query_href'] = req.session['query_href'] |
| 135 | 136 | else: |
| 136 | 137 | data['query_href'] = None |
| 137 | 138 | |
diff -r 7154aa4a3de9 trac/ticket/templates/report_list.html
|
a
|
b
|
|
| 13 | 13 | <body> |
| 14 | 14 | <div id="content" class="report"> |
| 15 | 15 | |
| 16 | | <h1>Available Reports |
| 17 | | <span id="trac-sort-order" py:with="report_asc = asc if sort == 'report' else None; |
| 18 | | title_asc = asc if sort == 'title' else None"> |
| 19 | | Sorted by: |
| 20 | | <a href="${href.report(sort='report', asc=report_asc and '0' or '1')}" |
| 21 | | class="${('desc', 'asc')[report_asc] if report_asc is not None else None}"> |
| 22 | | Identifier</a> |
| 23 | | <a href="${href.report(sort='title', asc=title_asc and '0' or '1')}" |
| 24 | | class="${('desc', 'asc')[title_asc] if title_asc is not None else None}"> |
| 25 | | Title</a> |
| 26 | | </span> |
| 27 | | </h1> |
| | 16 | <h1>Available Reports</h1> |
| 28 | 17 | |
| 29 | 18 | <div id="description" /> |
| 30 | 19 | |
| 31 | 20 | <div py:choose="" class="reports"> |
| | 21 | <div py:if="saved_query_href"> |
| | 22 | <h2><a href="$saved_query_href"><em>Return to last query</em></a></h2> |
| | 23 | <div class="description"> |
| | 24 | <p>Continue browsing through the current list of results, |
| | 25 | from the selected report or custom query.</p> |
| | 26 | </div> |
| | 27 | </div> |
| | 28 | |
| | 29 | <div py:if="query_href"> |
| | 30 | <h2><a href="$query_href"><em>Custom Query</em></a></h2> |
| | 31 | <div class="description"> |
| | 32 | <p>Compose a new ticket query by selecting filters and columns to display.</p> |
| | 33 | </div> |
| | 34 | </div> |
| | 35 | |
| 32 | 36 | <py:when test="reports"> |
| | 37 | <h3> |
| | 38 | <span id="trac-sort-order" py:with="report_asc = asc if sort == 'report' else None; |
| | 39 | title_asc = asc if sort == 'title' else None"> |
| | 40 | All reports sorted by: |
| | 41 | <a href="${href.report(sort='report', asc=report_asc and '0' or '1')}" |
| | 42 | class="${('desc', 'asc')[report_asc] if report_asc is not None else None}"> |
| | 43 | Identifier</a> |
| | 44 | <a href="${href.report(sort='title', asc=title_asc and '0' or '1')}" |
| | 45 | class="${('desc', 'asc')[title_asc] if title_asc is not None else None}"> |
| | 46 | Title</a> |
| | 47 | </span> |
| | 48 | </h3> |
| | 49 | |
| 33 | 50 | <div py:for="id, title, description, can_edit, can_delete in reports"> |
| 34 | 51 | <h2> |
| 35 | 52 | <a title="View report" href="${href.report(id)}">{$id} <em>$title</em></a> |