Skip to content
Snippets Groups Projects
Commit 29352cef74ae authored by Arthur Lutz's avatar Arthur Lutz
Browse files

[views] fix pagination (incorrect total pages) and arrows

parent 3b83955eb5ce
No related branches found
No related tags found
No related merge requests found
......@@ -160,10 +160,10 @@
'''
Pagination HTML generation
'''
if response.hits.total < 10:
if response.hits.total <= 10:
return
url_params = self._cw.form.copy()
with t.ul(self.w, klass="pagination") as ul:
current_page = int(url_params.get('page', 1))
url_params['page'] = current_page - 1
if current_page - 1 >= 1:
......@@ -164,10 +164,10 @@
return
url_params = self._cw.form.copy()
with t.ul(self.w, klass="pagination") as ul:
current_page = int(url_params.get('page', 1))
url_params['page'] = current_page - 1
if current_page - 1 >= 1:
ul(t.li(t.a('&gt;' * 3,
ul(t.li(t.a('&lt;' * 3,
href=self._cw.build_url(**url_params))))
else:
ul(t.li(t.a('&lt;' * 3)))
......@@ -171,7 +171,7 @@
href=self._cw.build_url(**url_params))))
else:
ul(t.li(t.a('&lt;' * 3)))
total_pages = response.hits.total / 10
total_pages = (response.hits.total / 10) + 2
page_padding = 3
if current_page > page_padding:
......@@ -194,7 +194,7 @@
url_params['page'] = current_page + 1
if current_page + 1 >= (total_pages):
ul(t.li(t.a('&lt;' * 3)))
ul(t.li(t.a('&gt;' * 3)))
else:
ul(t.li(t.a('&gt;' * 3,
href=self._cw.build_url(**url_params))))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment