diff --git a/templates/audit_log.html b/templates/audit_log.html index 696368ff..8455276f 100644 --- a/templates/audit_log.html +++ b/templates/audit_log.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% from "components/pagination.html" import Pagination %} {% block content %} @@ -40,50 +41,5 @@ - {% macro Page(pagination, route, i, label=None) -%} - {% set label = label or i %} - - {% if i == pagination.page %} - - {% else %} - {{ label }} - {% endif%} - {%- endmacro %} - - {% macro Pagination(pagination, route) -%} - {% set first %} - {{ Page(pagination, route, 1, label="first") }} - {{ Page(pagination, route, pagination.page - 1, label="prev") }} - {% endset %} - - {% set last %} - {{ Page(pagination, route, pagination.page + 1, label="next") }} - {{ Page(pagination, route, pagination.pages, label="last") }} - {% endset %} - - - {%- endmacro %} {{ Pagination(audit_events, 'atst.activity_history') }} {% endblock %} diff --git a/templates/components/pagination.html b/templates/components/pagination.html new file mode 100644 index 00000000..9f45c44e --- /dev/null +++ b/templates/components/pagination.html @@ -0,0 +1,45 @@ +{% macro Page(pagination, route, i, label=None) -%} + {% set label = label or i %} + + {% if i == pagination.page %} + + {% else %} + {{ label }} + {% endif%} +{%- endmacro %} + +{% macro Pagination(pagination, route) -%} + {% set first %} + {{ Page(pagination, route, 1, label="first") }} + {{ Page(pagination, route, pagination.page - 1, label="prev") }} + {% endset %} + + {% set last %} + {{ Page(pagination, route, pagination.page + 1, label="next") }} + {{ Page(pagination, route, pagination.pages, label="last") }} + {% endset %} + + +{%- endmacro %}