Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
redl
redeleitsystem
Commits
323a89a1
Commit
323a89a1
authored
Nov 07, 2015
by
Hinrikus Wolf
Browse files
add support for more than one button per form
parent
1544643f
Changes
3
Hide whitespace changes
Inline
Side-by-side
templates/admin_statement_new.html
View file @
323a89a1
...
...
@@ -3,5 +3,5 @@
{% block admin_title %}Add Statement{% endblock %}
{% block content %}
{{ render_form(form, action_url=url_for(".statement_new"),
action_text="Add", title="Add S
tatement") }}
{{ render_form(form, action_url=url_for(".statement_new"),
btn_list=[("","Add Statement","add_statement"), ("redl-btn-meta","Add Meta","add_meta_s
tatement")
])
}}
{% endblock %}
templates/admin_topic_show.html
View file @
323a89a1
...
...
@@ -44,7 +44,7 @@
</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"
>
{{ 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"
>
<ul>
{% if topic.sorted_statements()|length() > 0 %}
...
...
templates/macros.html
View file @
323a89a1
...
...
@@ -104,7 +104,7 @@
{%- 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_ }}"
>
<form
method=
"POST"
action=
"{{ action_url }}"
>
<div
class=
"{{ title_class }}"
>
...
...
@@ -133,8 +133,16 @@
{% endfor %}
</div>
<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>
</form>
</div>
{%- endmacro %}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment