Skip to content

Commit 0847b68

Browse files
committed
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.
1 parent ada6f69 commit 0847b68

File tree

8 files changed

+92
-14
lines changed

8 files changed

+92
-14
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Fixed:
4343
non-labeled multilink by John Rouillard)
4444
- in cgi/client.py, set self.language attribute when translator passed
4545
into Client(). (John Rouillard)
46+
- issue2551393 - Named searches lose their name in title when next
47+
page is selected. (John Rouillard)
4648

4749
Features:
4850

doc/upgrading.txt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,46 @@ The logging format is now a ``config.ini`` parameter in the
137137
would like the old logging format without having to create a logging
138138
configuration file. See :ref:`rounduplogging` for details.
139139

140+
Make Pagination Links Keep Search Name (optional)
141+
-------------------------------------------------
142+
143+
When displaying a named search, index templates don't preserve
144+
the name when using the pagination (Next/Prev) links. This is
145+
fixed in the 2.6.0 templates for issues/bugs/tasks. To make the
146+
change to your templates, look for the pagination links (look for
147+
prev or previous case insensitive) in your tracker's html
148+
subdirectory and change::
149+
150+
request.indexargs_url(request.classname,
151+
{'@startwith':prev.first, '@pagesize':prev.size})"
152+
153+
to read::
154+
155+
request.indexargs_url(request.classname,
156+
dict({'@dispname': request.dispname}
157+
if request.dispname
158+
else {},
159+
**{'@startwith':prev.first, '@pagesize':prev.size}))"
160+
161+
This code will be embedded in templating markup that is not shown
162+
above. The change above is for your previous/prev link. The
163+
change for the next pagination link is similar with::
164+
165+
{'@startwith':next.first, '@pagesize':next.size}
166+
167+
replacing::
168+
169+
{'@startwith':prev.first, '@pagesize':prev.size}
170+
171+
in the example.
172+
173+
This moves the existing dictionary used to override the URL
174+
arguments to the second argument inside a ``dict()`` call. It
175+
also adds ``**`` before it. This change creates a new override
176+
dictionary that includes an ``@dispname`` parameter if it is set
177+
in the request. If ``@dispname`` is not set, the existing
178+
dictionary contents are used.
179+
140180
Support authorized changes in your tracker (optional)
141181
-----------------------------------------------------
142182

share/roundup/templates/classic/html/issue.index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@
7979
<th>
8080
<a tal:define="prev batch/previous" tal:condition="prev"
8181
tal:attributes="href python:request.indexargs_url(request.classname,
82-
{'@startwith':prev.first, '@pagesize':prev.size})"
82+
dict({'@dispname': request.dispname}
83+
if request.dispname
84+
else {},
85+
**{'@startwith':prev.first, '@pagesize':prev.size}))"
8386
i18n:translate="">&lt;&lt; previous</a>
8487
&nbsp;
8588
</th>
@@ -90,7 +93,10 @@
9093
<th>
9194
<a tal:define="next batch/next" tal:condition="next"
9295
tal:attributes="href python:request.indexargs_url(request.classname,
93-
{'@startwith':next.first, '@pagesize':next.size})"
96+
dict({'@dispname': request.dispname}
97+
if request.dispname
98+
else {},
99+
**{'@startwith':next.first, '@pagesize':next.size}))"
94100
i18n:translate="">next &gt;&gt;</a>
95101
&nbsp;
96102
</th>

share/roundup/templates/devel/html/bug.index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@
9393
<th>
9494
<a tal:define="prev batch/previous" tal:condition="prev"
9595
tal:attributes="href python:request.indexargs_url(request.classname,
96-
{'@startwith':prev.first, '@pagesize':prev.size})"
96+
dict({'@dispname': request.dispname}
97+
if request.dispname
98+
else {},
99+
**{'@startwith':prev.first, '@pagesize':prev.size}))"
97100
i18n:translate="">&lt;&lt; previous</a>
98101
&nbsp;
99102
</th>
@@ -104,7 +107,10 @@
104107
<th>
105108
<a tal:define="next batch/next" tal:condition="next"
106109
tal:attributes="href python:request.indexargs_url(request.classname,
107-
{'@startwith':next.first, '@pagesize':next.size})"
110+
dict({'@dispname': request.dispname}
111+
if request.dispname
112+
else {},
113+
**{'@startwith':next.first, '@pagesize':next.size}))"
108114
i18n:translate="">next &gt;&gt;</a>
109115
&nbsp;
110116
</th>

share/roundup/templates/devel/html/task.index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@
8484
<th>
8585
<a tal:define="prev batch/previous" tal:condition="prev"
8686
tal:attributes="href python:request.indexargs_url(request.classname,
87-
{'@startwith':prev.first, '@pagesize':prev.size})"
87+
dict({'@dispname': request.dispname}
88+
if request.dispname
89+
else {},
90+
**{'@startwith':prev.first, '@pagesize':prev.size}))"
8891
i18n:translate="">&lt;&lt; previous</a>
8992
&nbsp;
9093
</th>
@@ -95,7 +98,10 @@
9598
<th>
9699
<a tal:define="next batch/next" tal:condition="next"
97100
tal:attributes="href python:request.indexargs_url(request.classname,
98-
{'@startwith':next.first, '@pagesize':next.size})"
101+
dict({'@dispname': request.dispname}
102+
if request.dispname
103+
else {},
104+
**{'@startwith':next.first, '@pagesize':next.size}))"
99105
i18n:translate="">next &gt;&gt;</a>
100106
&nbsp;
101107
</th>

share/roundup/templates/jinja2/html/layout/pagination.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
{% if batch and batch.previous %}
55
<li class="page-item">
66
<a class="page-link" href="{{ request.indexargs_url(request.classname,
7-
{'@startwith':batch.previous().first, '@pagesize':batch.previous().size}) }}">{% trans %}Previous{% endtrans %}</a>
7+
dict({'@dispname': request.dispname}
8+
if request.dispname
9+
else {},
10+
**{'@startwith':batch.previous().first, '@pagesize':batch.previous().size})) }}">{% trans %}Previous{% endtrans %}</a>
811
</li>
912
{% else %}
1013
<li class='page-item disabled'>
@@ -21,7 +24,10 @@
2124
{% if batch and batch.next() %}
2225
<li class="page-item">
2326
<a class="page-link" href="{{ request.indexargs_url(request.classname,
24-
{'@startwith':batch.next().first, '@pagesize':batch.next().size}) }}">{% trans %}Next{% endtrans %}</a>
27+
dict({'@dispname': request.dispname}
28+
if request.dispname
29+
else {},
30+
**{'@startwith':batch.next().first, '@pagesize':batch.next().size})) }}">{% trans %}Next{% endtrans %}</a>
2531
</li>
2632
{% else %}
2733
<li class='page-item disabled'>

share/roundup/templates/responsive/html/bug.index.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@
8282
<ul>
8383
<li tal:define="prev batch/previous" tal:condition="prev" class='disabled'>
8484
<a tal:define="prev batch/previous" tal:condition="prev"
85-
tal:attributes="href python:request.indexargs_url(request.classname,
86-
{'@startwith':prev.first, '@pagesize':prev.size})"
85+
tal:attributes="href python:request.indexargs_url(request.classname,
86+
dict({'@dispname': request.dispname}
87+
if request.dispname
88+
else {},
89+
**{'@startwith':prev.first, '@pagesize':prev.size}))"
8790
i18n:translate="">Previous</a>
8891
</li>
8992
<li tal:define="prev batch/previous" tal:condition="not:prev" class='disabled'><a href='#' i18n:translate="">Previous</a></li>
@@ -95,7 +98,10 @@
9598
<li tal:define="next batch/next" tal:condition="next" class='disabled'>
9699
<a tal:define="next batch/next" tal:condition="next"
97100
tal:attributes="href python:request.indexargs_url(request.classname,
98-
{'@startwith':next.first, '@pagesize':next.size})"
101+
dict({'@dispname': request.dispname}
102+
if request.dispname
103+
else {},
104+
**{'@startwith':next.first, '@pagesize':next.size}))"
99105
i18n:translate="">Next</a>
100106
</li>
101107
<li tal:define="next batch/next" tal:condition="not:next" class='disabled'><a href='#' i18n:translate="">Next</a></li>

share/roundup/templates/responsive/html/task.index.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@
7676
<ul>
7777
<li tal:define="prev batch/previous" tal:condition="prev" class='disabled'>
7878
<a tal:define="prev batch/previous" tal:condition="prev"
79-
tal:attributes="href python:request.indexargs_url(request.classname,
80-
{'@startwith':prev.first, '@pagesize':prev.size})"
79+
tal:attributes="href python:request.indexargs_url(request.classname,
80+
dict({'@dispname': request.dispname}
81+
if request.dispname
82+
else {},
83+
**{'@startwith':prev.first, '@pagesize':prev.size}))"
8184
i18n:translate="">Previous</a>
8285
</li>
8386
<li tal:define="prev batch/previous" tal:condition="not:prev" class='disabled'><a href='#' i18n:translate="">Previous</a></li>
@@ -89,7 +92,10 @@
8992
<li tal:define="next batch/next" tal:condition="next" class='disabled'>
9093
<a tal:define="next batch/next" tal:condition="next"
9194
tal:attributes="href python:request.indexargs_url(request.classname,
92-
{'@startwith':next.first, '@pagesize':next.size})"
95+
dict({'@dispname': request.dispname}
96+
if request.dispname
97+
else {},
98+
**{'@startwith':next.first, '@pagesize':next.size}))"
9399
i18n:translate="">Next</a>
94100
</li>
95101
<li tal:define="next batch/next" tal:condition="not:next" class='disabled'><a href='#' i18n:translate="">Next</a></li>

0 commit comments

Comments
 (0)