changeset 8510:00aec15117c0

bug: Issue2551393 - keep search name when paginating Title: Named searches lose their name in title when next page is selected. Include dispname in next/prev(ious) URL pagination links in index pages if dispname is defined.
author John Rouillard <rouilj@ieee.org>
date Tue, 27 Jan 2026 21:07:02 -0500
parents 03f55c0168f6
children 951db0950174
files CHANGES.txt doc/upgrading.txt share/roundup/templates/classic/html/issue.index.html share/roundup/templates/devel/html/bug.index.html share/roundup/templates/devel/html/task.index.html share/roundup/templates/jinja2/html/layout/pagination.html share/roundup/templates/responsive/html/bug.index.html share/roundup/templates/responsive/html/task.index.html
diffstat 8 files changed, 92 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Tue Jan 27 21:00:11 2026 -0500
+++ b/CHANGES.txt	Tue Jan 27 21:07:02 2026 -0500
@@ -43,6 +43,8 @@
   non-labeled multilink by John Rouillard)
 - in cgi/client.py, set self.language attribute when translator passed
   into Client(). (John Rouillard)
+- issue2551393 -  Named searches lose their name in title when next
+  page is selected. (John Rouillard)
 
 Features:
 
--- a/doc/upgrading.txt	Tue Jan 27 21:00:11 2026 -0500
+++ b/doc/upgrading.txt	Tue Jan 27 21:07:02 2026 -0500
@@ -137,6 +137,46 @@
 would like the old logging format without having to create a logging
 configuration file. See :ref:`rounduplogging` for details.
 
+Make Pagination Links Keep Search Name (optional)
+-------------------------------------------------
+
+When displaying a named search, index templates don't preserve
+the name when using the pagination (Next/Prev) links. This is
+fixed in the 2.6.0 templates for issues/bugs/tasks. To make the
+change to your templates, look for the pagination links (look for
+prev or previous case insensitive) in your tracker's html
+subdirectory and change::
+
+   request.indexargs_url(request.classname,
+         {'@startwith':prev.first, '@pagesize':prev.size})"
+
+to read::
+
+   request.indexargs_url(request.classname,
+                     dict({'@dispname': request.dispname}
+                     if request.dispname
+                     else {},
+                     **{'@startwith':prev.first, '@pagesize':prev.size}))"
+
+This code will be embedded in templating markup that is not shown
+above. The change above is for your previous/prev link. The
+change for the next pagination link is similar with::
+
+   {'@startwith':next.first, '@pagesize':next.size}
+
+replacing::
+
+    {'@startwith':prev.first, '@pagesize':prev.size}
+
+in the example.
+
+This moves the existing dictionary used to override the URL
+arguments to the second argument inside a ``dict()`` call. It
+also adds ``**`` before it. This change creates a new override
+dictionary that includes an ``@dispname`` parameter if it is set
+in the request. If ``@dispname`` is not set, the existing
+dictionary contents are used.
+
 Support authorized changes in your tracker (optional)
 -----------------------------------------------------
 
--- a/share/roundup/templates/classic/html/issue.index.html	Tue Jan 27 21:00:11 2026 -0500
+++ b/share/roundup/templates/classic/html/issue.index.html	Tue Jan 27 21:07:02 2026 -0500
@@ -79,7 +79,10 @@
      <th>
       <a tal:define="prev batch/previous" tal:condition="prev"
          tal:attributes="href python:request.indexargs_url(request.classname,
-         {'@startwith':prev.first, '@pagesize':prev.size})"
+                     dict({'@dispname': request.dispname}
+                     if request.dispname
+                     else {},
+                     **{'@startwith':prev.first, '@pagesize':prev.size}))"
          i18n:translate="">&lt;&lt; previous</a>
       &nbsp;
      </th>
@@ -90,7 +93,10 @@
      <th>
       <a tal:define="next batch/next" tal:condition="next"
          tal:attributes="href python:request.indexargs_url(request.classname,
-         {'@startwith':next.first, '@pagesize':next.size})"
+                     dict({'@dispname': request.dispname}
+                     if request.dispname
+                     else {},
+                     **{'@startwith':next.first, '@pagesize':next.size}))"
          i18n:translate="">next &gt;&gt;</a>
       &nbsp;
      </th>
--- a/share/roundup/templates/devel/html/bug.index.html	Tue Jan 27 21:00:11 2026 -0500
+++ b/share/roundup/templates/devel/html/bug.index.html	Tue Jan 27 21:07:02 2026 -0500
@@ -93,7 +93,10 @@
      <th>
       <a tal:define="prev batch/previous" tal:condition="prev"
          tal:attributes="href python:request.indexargs_url(request.classname,
-         {'@startwith':prev.first, '@pagesize':prev.size})"
+                     dict({'@dispname': request.dispname}
+                     if request.dispname
+                     else {},
+                     **{'@startwith':prev.first, '@pagesize':prev.size}))"
          i18n:translate="">&lt;&lt; previous</a>
       &nbsp;
      </th>
@@ -104,7 +107,10 @@
      <th>
       <a tal:define="next batch/next" tal:condition="next"
          tal:attributes="href python:request.indexargs_url(request.classname,
-         {'@startwith':next.first, '@pagesize':next.size})"
+                     dict({'@dispname': request.dispname}
+                     if request.dispname
+                     else {},
+                     **{'@startwith':next.first, '@pagesize':next.size}))"
          i18n:translate="">next &gt;&gt;</a>
       &nbsp;
      </th>
--- a/share/roundup/templates/devel/html/task.index.html	Tue Jan 27 21:00:11 2026 -0500
+++ b/share/roundup/templates/devel/html/task.index.html	Tue Jan 27 21:07:02 2026 -0500
@@ -84,7 +84,10 @@
      <th>
       <a tal:define="prev batch/previous" tal:condition="prev"
          tal:attributes="href python:request.indexargs_url(request.classname,
-         {'@startwith':prev.first, '@pagesize':prev.size})"
+                     dict({'@dispname': request.dispname}
+                     if request.dispname
+                     else {},
+                     **{'@startwith':prev.first, '@pagesize':prev.size}))"
          i18n:translate="">&lt;&lt; previous</a>
       &nbsp;
      </th>
@@ -95,7 +98,10 @@
      <th>
       <a tal:define="next batch/next" tal:condition="next"
          tal:attributes="href python:request.indexargs_url(request.classname,
-         {'@startwith':next.first, '@pagesize':next.size})"
+                     dict({'@dispname': request.dispname}
+                     if request.dispname
+                     else {},
+                     **{'@startwith':next.first, '@pagesize':next.size}))"
          i18n:translate="">next &gt;&gt;</a>
       &nbsp;
      </th>
--- a/share/roundup/templates/jinja2/html/layout/pagination.html	Tue Jan 27 21:00:11 2026 -0500
+++ b/share/roundup/templates/jinja2/html/layout/pagination.html	Tue Jan 27 21:07:02 2026 -0500
@@ -4,7 +4,10 @@
     {% if batch and batch.previous %}
       <li class="page-item">
         <a class="page-link" href="{{ request.indexargs_url(request.classname,
-                                   {'@startwith':batch.previous().first, '@pagesize':batch.previous().size}) }}">{% trans %}Previous{% endtrans %}</a>
+                                   dict({'@dispname': request.dispname}
+                                   if request.dispname
+                                   else {},
+                                   **{'@startwith':batch.previous().first, '@pagesize':batch.previous().size})) }}">{% trans %}Previous{% endtrans %}</a>
       </li>
     {% else %}
       <li class='page-item disabled'>
@@ -21,7 +24,10 @@
     {% if batch and batch.next() %}
       <li class="page-item">
         <a class="page-link" href="{{ request.indexargs_url(request.classname,
-                                   {'@startwith':batch.next().first, '@pagesize':batch.next().size}) }}">{% trans %}Next{% endtrans %}</a>
+                                   dict({'@dispname': request.dispname}
+                                   if request.dispname
+                                   else {},
+                                   **{'@startwith':batch.next().first, '@pagesize':batch.next().size})) }}">{% trans %}Next{% endtrans %}</a>
       </li>
     {% else %}
       <li class='page-item disabled'>
--- a/share/roundup/templates/responsive/html/bug.index.html	Tue Jan 27 21:00:11 2026 -0500
+++ b/share/roundup/templates/responsive/html/bug.index.html	Tue Jan 27 21:07:02 2026 -0500
@@ -82,8 +82,11 @@
     <ul>
       <li tal:define="prev batch/previous" tal:condition="prev" class='disabled'>
         <a tal:define="prev batch/previous" tal:condition="prev"
-         tal:attributes="href python:request.indexargs_url(request.classname,
-         {'@startwith':prev.first, '@pagesize':prev.size})"
+           tal:attributes="href python:request.indexargs_url(request.classname,
+                       dict({'@dispname': request.dispname}
+                       if request.dispname
+                       else {},
+                       **{'@startwith':prev.first, '@pagesize':prev.size}))"
          i18n:translate="">Previous</a>
       </li>
       <li tal:define="prev batch/previous" tal:condition="not:prev" class='disabled'><a href='#' i18n:translate="">Previous</a></li>
@@ -95,7 +98,10 @@
       <li tal:define="next batch/next" tal:condition="next" class='disabled'>
       <a tal:define="next batch/next" tal:condition="next"
          tal:attributes="href python:request.indexargs_url(request.classname,
-         {'@startwith':next.first, '@pagesize':next.size})"
+                     dict({'@dispname': request.dispname}
+                     if request.dispname
+                     else {},
+                     **{'@startwith':next.first, '@pagesize':next.size}))"
          i18n:translate="">Next</a>
       </li>
       <li tal:define="next batch/next" tal:condition="not:next" class='disabled'><a href='#' i18n:translate="">Next</a></li>
--- a/share/roundup/templates/responsive/html/task.index.html	Tue Jan 27 21:00:11 2026 -0500
+++ b/share/roundup/templates/responsive/html/task.index.html	Tue Jan 27 21:07:02 2026 -0500
@@ -76,8 +76,11 @@
     <ul>
       <li tal:define="prev batch/previous" tal:condition="prev" class='disabled'>
         <a tal:define="prev batch/previous" tal:condition="prev"
-         tal:attributes="href python:request.indexargs_url(request.classname,
-         {'@startwith':prev.first, '@pagesize':prev.size})"
+           tal:attributes="href python:request.indexargs_url(request.classname,
+                       dict({'@dispname': request.dispname}
+                       if request.dispname
+                       else {},
+                       **{'@startwith':prev.first, '@pagesize':prev.size}))"
          i18n:translate="">Previous</a>
       </li>
       <li tal:define="prev batch/previous" tal:condition="not:prev" class='disabled'><a href='#' i18n:translate="">Previous</a></li>
@@ -89,7 +92,10 @@
       <li tal:define="next batch/next" tal:condition="next" class='disabled'>
       <a tal:define="next batch/next" tal:condition="next"
          tal:attributes="href python:request.indexargs_url(request.classname,
-         {'@startwith':next.first, '@pagesize':next.size})"
+                     dict({'@dispname': request.dispname}
+                     if request.dispname
+                     else {},
+                     **{'@startwith':next.first, '@pagesize':next.size}))"
          i18n:translate="">Next</a>
       </li>
       <li tal:define="next batch/next" tal:condition="not:next" class='disabled'><a href='#' i18n:translate="">Next</a></li>

Roundup Issue Tracker: http://roundup-tracker.org/