diff --git a/views.py b/views.py index b31c7fa7d65efccd944513d7ebc9c77e7b2c203f_dmlld3MucHk=..08dc78d5c65837b8cfef91495bb9c5cb4ee9e7a4_dmlld3MucHk= 100644 --- a/views.py +++ b/views.py @@ -78,6 +78,9 @@ class ElasticSearchView(StartupView): __regid__ = "esearch" + previous_link = u' < ' + next_link = u' > ' + middle_link = u" · " * 3 def render_search_comp(self): search_comp = self._cw.vreg['components'].select_or_none('search-comp', @@ -201,6 +204,6 @@ current_page = int(url_params.get('page', 1)) url_params['page'] = current_page - 1 if current_page - 1 >= 1: - ul(t.li(t.a(u' < ' * 3, + ul(t.li(t.a(self.previous_link, href=xml_escape(self._cw.build_url(**url_params))))) else: @@ -205,6 +208,6 @@ href=xml_escape(self._cw.build_url(**url_params))))) else: - ul(t.li(t.a(u' < ' * 3))) + ul(t.li(t.a(self.previous_link))) total_pages = (response.hits.total / 10) + 2 page_padding = 3 @@ -214,9 +217,9 @@ current_page - page_padding)): self.page_number(url_params, page, current_page, ul) if current_page > (page_padding * 2) + 1: - ul(t.li(t.a(u" · " * 3))) + ul(t.li(t.a(self.middle_link))) for page in range(max(1, current_page - page_padding), min(current_page + page_padding, total_pages)): self.page_number(url_params, page, current_page, ul) if current_page < total_pages - page_padding: if current_page < total_pages - page_padding * 2: @@ -218,9 +221,9 @@ for page in range(max(1, current_page - page_padding), min(current_page + page_padding, total_pages)): self.page_number(url_params, page, current_page, ul) if current_page < total_pages - page_padding: if current_page < total_pages - page_padding * 2: - ul(t.li(t.a(u" · " * 3))) + ul(t.li(t.a(self.middle_link))) for page in range(max(current_page + page_padding, total_pages - page_padding), total_pages): @@ -228,5 +231,5 @@ url_params['page'] = current_page + 1 if current_page + 1 >= (total_pages): - ul(t.li(t.a(u' > ' * 3))) + ul(t.li(t.a(self.next_link))) else: @@ -232,5 +235,5 @@ else: - ul(t.li(t.a(u' > ' * 3, + ul(t.li(t.a(self.next_link, href=xml_escape(self._cw.build_url(**url_params))))) def page_number(self, url_params, page, current_page, ul):