Skip to content
Snippets Groups Projects
Commit 323a89a1 authored by Hinrikus Wolf's avatar Hinrikus Wolf
Browse files

add support for more than one button per form

parent 1544643f
No related branches found
No related tags found
No related merge requests found
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
{% block admin_title %}Add Statement{% endblock %} {% block admin_title %}Add Statement{% endblock %}
{% block content %} {% block content %}
{{ render_form(form, action_url=url_for(".statement_new"), action_text="Add", title="Add Statement") }} {{ render_form(form, action_url=url_for(".statement_new"), btn_list=[("","Add Statement","add_statement"), ("redl-btn-meta","Add Meta","add_meta_statement")]) }}
{% endblock %} {% endblock %}
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</div> </div>
<div class="mdl-separator rede-separator"></div> <div class="mdl-separator rede-separator"></div>
<div class="mdl-cell mdl-cell--3-col mdl-cell--3-col-tablet mdl-cell--4-col-phone mdl-grid mdl-grid--no-spacing"> <div class="mdl-cell mdl-cell--3-col mdl-cell--3-col-tablet mdl-cell--4-col-phone mdl-grid mdl-grid--no-spacing">
{{ render_form(form, action_url=url_for(".statement_new"), action_text="Add", title="Add Statement", class_="mdl-card mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-cell--8-col-tablet mdl-cell--4-col-phone") }} {{ render_form(form, action_url=url_for(".statement_new"), action_text="Add", title="Add Statement", class_="mdl-card mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-cell--8-col-tablet mdl-cell--4-col-phone", btn_list=[("","Add Statement","add_statement"), ("redl-btn-meta","Add Meta","add_meta_statement")] ) }}
<div class="mdl-cell mdl-card mdl-shadow--2dp mdl-cell--12-col mdl-cell--8-col-tablet mdl-cell--4-col-phone"> <div class="mdl-cell mdl-card mdl-shadow--2dp mdl-cell--12-col mdl-cell--8-col-tablet mdl-cell--4-col-phone">
<ul> <ul>
{% if topic.sorted_statements()|length() > 0 %} {% if topic.sorted_statements()|length() > 0 %}
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
{%- endmacro %} {%- endmacro %}
{% macro render_form(form, action_url="", title=None, action_text="Submit", class_="mdl-card mdl-shadow--2dp mdl-cell mdl-cell--4-col mdl-cell--4-col-tablet mdl-cell--4-col-phone", title_class="mdl-card__title", title_text_class="mdl-card__title-text", content_class="mdl-card__supporting-text", action_class="mdl-card__actions", btn_class="mdl-button mdl-js-button mdl-button--raised mdl-button-colored") -%} {% macro render_form(form, action_url="", title=None, action_text="Submit", class_="mdl-card mdl-shadow--2dp mdl-cell mdl-cell--4-col mdl-cell--4-col-tablet mdl-cell--4-col-phone", title_class="mdl-card__title", title_text_class="mdl-card__title-text", content_class="mdl-card__supporting-text", action_class="mdl-card__actions", btn_class="mdl-button mdl-js-button mdl-button--raised mdl-button-colored", btn_value="", btn_list=None) -%}
<div class="{{ class_ }}"> <div class="{{ class_ }}">
<form method="POST" action="{{ action_url }}"> <form method="POST" action="{{ action_url }}">
<div class="{{ title_class }}"> <div class="{{ title_class }}">
...@@ -133,8 +133,16 @@ ...@@ -133,8 +133,16 @@
{% endfor %} {% endfor %}
</div> </div>
<div class="{{ action_class }}"> <div class="{{ action_class }}">
<button type="submit" class="{{ btn_class }}">{{ action_text }}</button> {% if btn_list != none %}
{%for this_btn_class, action_text, btn_value in btn_list %}
<button type="submit" class="{{ btn_class }} {{ this_btn_class }}", value="{{ btn_value }}">{{ action_text }}</button>
{% endfor %}
{% else %}
<button type="submit" class="{{ btn_class }}", value="{{ btn_value }}">{{ action_text }}</button>
{% endif %}
</div> </div>
</form> </form>
</div> </div>
{%- endmacro %} {%- endmacro %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment