Commit d15bbfa0 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Replace page_link macros by generic version

parent 0320e65b
......@@ -2,7 +2,7 @@
{% from "macros.html" import render_table, render_form %}
{% block title %}Beschlüsse{% endblock %}
{% macro page_link(text, _page=None, _page_length=None) %}
{#{% macro page_link(text, _page=None, _page_length=None) %}
{% if _page is none %}
{% set _page = page %}
{% endif %}
......@@ -10,7 +10,7 @@
{% set _page_length = page_length %}
{% endif %}
<a href="{{url_for(request.endpoint, page=_page, protocoltype_id=protocoltype_id, search=search_term, decisioncategory_id=decisioncategory_id, page_length=_page_length)}}">{{text}}</a>
{% endmacro %}
{% endmacro %}#}
{% block content %}
<div class="container">
......
......@@ -165,6 +165,18 @@ to not render a label for the CRSFTokenField -->
</table>
{%- endmacro %}
{% macro page_link(text, _page=None, _page_length=None) -%}
{% set args = request.view_args.copy() %}
{% set _ = args.update(request.args) %}
{% if _page is not none %}
{% set _ = args.update({"page": _page}) %}
{% endif %}
{% if _page_length is not none %}
{% set _ = args.update({"page_length": _page_length}) %}
{% endif %}
<a href="{{url_for(request.endpoint, **args)}}">{{text}}</a>
{%- endmacro %}
{% macro render_likes(likes) -%}
{% set timestamp = now() %}
{% if timestamp.month == 4 and timestamp.day == 1 %}
......
{% from "macros.html" import page_link %}
<div class="centered">
{% if page > page_diff %}
{{page_link("<<", _page=0)}}
......
......@@ -2,18 +2,6 @@
{% from "macros.html" import render_table, render_form %}
{% block title %}Protokolle{% endblock %}
{% macro page_link(text, _page=None, _page_length=None) %}
{% if _page is none %}
{% set _page = page %}
{% endif %}
{% if _page_length is none %}
{% set _page_length = page_length %}
{% endif %}
<a href="{{url_for(request.endpoint, page=_page, protocoltype_id=protocoltype_id, search=search_term, state_open=state_open, page_length=_page_length)}}">{{text}}</a>
{% endmacro %}
{% block content %}
<div class="container">
{{render_form(search_form, class_="form-inline", action_url=url_for("list_protocols"), action_text="Suchen", labels_visible=False, method="GET")}}
......
......@@ -2,16 +2,6 @@
{% from "macros.html" import render_table, render_form %}
{% block title %}Todos{% endblock %}
{% macro page_link(text, _page=None, _page_length=None) %}
{% if _page is none %}
{% set _page = page %}
{% endif %}
{% if _page_length is none %}
{% set _page_length = page_length %}
{% endif %}
<a href="{{url_for(request.endpoint, page=_page, protocoltype_id=protocoltype_id, search=search_term, state_open=state_open, page_length=_page_length)}}">{{text}}</a>
{% endmacro %}
{% block content %}
<div class="container">
{{render_form(search_form, class_="form-inline", action_url=url_for("list_todos"), action_text="Suchen", labels_visible=False, method="GET")}}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment