From 116a47f6057245159851ff204f9e4c1e643c3d8d Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Wed, 13 Nov 2019 16:58:09 +0100 Subject: move pagination into macros Two new macros: * top_results(found) * bottom_results(found) wip: move pagination into macro --- python/fatcat_web/templates/entity_macros.html | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'python/fatcat_web/templates/entity_macros.html') diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index fc199c21..5e980fec 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -234,3 +234,43 @@ yellow {% endif %} {%- endmacro %} +{% macro top_results(found) -%} + +Showing + {% if found.offset == 0 %} + first + {% else %} + results {{ found.offset }} — + {% endif %} + + {{ found.offset + found.count_returned }} + out of {{ found.count_found }} results + + +{%- endmacro %} + + +{% macro bottom_results(found) -%} + +{% if found.offset > 0 %} + {% if found.offset - found.limit < 0 %} + « Previous + {% else %} + « Previous + {% endif %} +{% else %} + « Previous +{% endif %} + +  Showing results {{ found.offset }} — {{ found.offset + +found.count_returned }} out of {{ found.count_found }} results   + +{% if found.offset + found.limit < found.count_found and found.offset + found.limit < found.deep_page_limit %} + Next » + {% else %} + Next » +{% endif %} + + + +{%- endmacro %} \ No newline at end of file -- cgit v1.2.3