Edgewall Software

Ticket #9604: custom-query-link.patch

File custom-query-link.patch, 3.9 KB (added by cboos, 21 months ago)

add a link to the last query and to a new custom query at the top of the list of reports. Applies on new_report_list-r10049.patch

  • trac/ticket/query.py

    # 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): 
    10671067               self.env.is_component_enabled(ReportModule): 
    10681068            data['report_href'] = req.href.report() 
    10691069            add_ctxtnav(req, _('Available Reports'), req.href.report()) 
    1070             add_ctxtnav(req, _('Custom Query')) 
     1070            add_ctxtnav(req, _('Custom Query'), req.href.query()) 
    10711071            if query.id: 
    10721072                cursor = db.cursor() 
    10731073                cursor.execute("SELECT title,description FROM report " 
  • trac/ticket/report.py

    diff -r 7154aa4a3de9 trac/ticket/report.py
    a b class ReportModule(Component): 
    132132                self.env.is_component_enabled(QueryModule): 
    133133            add_ctxtnav(req, _('Custom Query'), href=req.href.query()) 
    134134            data['query_href'] = req.href.query() 
     135            data['saved_query_href'] = req.session['query_href'] 
    135136        else: 
    136137            data['query_href'] = None 
    137138 
  • trac/ticket/templates/report_list.html

    diff -r 7154aa4a3de9 trac/ticket/templates/report_list.html
    a b  
    1313  <body> 
    1414    <div id="content" class="report"> 
    1515 
    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> 
    2817 
    2918      <div id="description" /> 
    3019 
    3120      <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 
    3236        <py:when test="reports"> 
     37          <h3>&nbsp; 
     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 
    3350          <div py:for="id, title, description, can_edit, can_delete in reports"> 
    3451            <h2> 
    3552              <a title="View report" href="${href.report(id)}">{$id} <em>$title</em></a>