# HG changeset patch # User Arthur Lutz <arthur.lutz@logilab.fr> # Date 1467391988 -7200 # Fri Jul 01 18:53:08 2016 +0200 # Node ID 29352cef74aef61553ce6eaf6d605ce3b7608d2f # Parent 3b83955eb5ce2e3b5d86b149b20657d919ac6377 [views] fix pagination (incorrect total pages) and arrows diff --git a/views.py b/views.py --- a/views.py +++ b/views.py @@ -160,18 +160,18 @@ ''' 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: - ul(t.li(t.a('>' * 3, + ul(t.li(t.a('<' * 3, href=self._cw.build_url(**url_params)))) else: ul(t.li(t.a('<' * 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('<' * 3))) + ul(t.li(t.a('>' * 3))) else: ul(t.li(t.a('>' * 3, href=self._cw.build_url(**url_params))))