From 3cf27379a3fa6243ef01289f2bbacfecaf8f7460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 7 Nov 2011 10:27:51 +0100 Subject: [PATCH] refactored batching code and added pagination to search results --- tabellio/searchform/batch_macros.pt | 157 ++++++++++++++++++++++++++++ tabellio/searchform/docsearch.pt | 79 ++++---------- tabellio/searchform/form.py | 2 + 3 files changed, 182 insertions(+), 56 deletions(-) create mode 100644 tabellio/searchform/batch_macros.pt diff --git a/tabellio/searchform/batch_macros.pt b/tabellio/searchform/batch_macros.pt new file mode 100644 index 0000000..8361af2 --- /dev/null +++ b/tabellio/searchform/batch_macros.pt @@ -0,0 +1,157 @@ + + + +You can feed in batch_base_url by enclosing +the metal:use-macro="context/batch_macros/macros/navigation" statement in your +template with a tal:define="batch_base_url YOUR_BASE_URL" tales expression. + +
+ + + + « + + Previous + n + items + + + + « + + Previous + n + items + + + + + + + + Next + n + items + + » + + + + Next + n + items + + » + + + + + Link to first + + + 1 + + … + + + + Page : + + + Pagelist with quantum leap links to previous pages for quick navigation + + + + + … + + + + Pagelist with links to previous pages for quick navigation + + + + + + + + Current page + + Current page number + + + Pagelist with links to next pages for quick navigation + + + + + + + + Pagelist with quantum leap links to next pages for quick navigation + + + … + + + + + + Link to last + + + + … + + 3457 + + +
+ + + diff --git a/tabellio/searchform/docsearch.pt b/tabellio/searchform/docsearch.pt index 223fbe4..ab9431f 100644 --- a/tabellio/searchform/docsearch.pt +++ b/tabellio/searchform/docsearch.pt @@ -9,6 +9,13 @@ +

@@ -20,16 +27,8 @@
-
@@ -48,14 +47,9 @@
- +
+
+
@@ -64,16 +58,8 @@
-
@@ -93,14 +79,9 @@
- +
+
+
@@ -109,16 +90,8 @@
-
@@ -138,19 +111,12 @@
- +
+
+
- -
Décrets
@@ -191,6 +157,7 @@ function author_autocomplete_ready(event, data, formatted) { })(jQuery); + diff --git a/tabellio/searchform/form.py b/tabellio/searchform/form.py index acc862f..66a877e 100644 --- a/tabellio/searchform/form.py +++ b/tabellio/searchform/form.py @@ -312,6 +312,8 @@ class GlobalSearchForm(form.Form): ignoreContext = True class SearchView(BrowserView): + batch_macros = ViewPageTemplateFile('batch_macros.pt') + def search_results(self, search_type): if self.request.form.get('document.widgets.search_type_is_document'):