Commit 3581f84d authored by Hinrikus Wolf's avatar Hinrikus Wolf

add support for meta-button, still useless

parent df2e165a
......@@ -274,14 +274,20 @@ def statement():
def statement_new():
form = AddStatementForm()
if form.validate_on_submit():
topic = Topic.query.filter_by(id=form.topic.data).first()
speaker = speaker_by_name_or_number(form.speaker_name.data, topic.event.id)
if topic is not None and speaker is not None:
if speaker.count_active(topic) == 0:
statement = Statement(speaker.id, topic.id)
db.session.add(statement)
db.session.commit()
statement = request.form.get("submit","add_statement")
if statement == "add_meta_statement":
topic = Topic.query.filter_by(id=form.topic.data).first()
return redirect(url_for(".topic_show", id=topic.id))
else:
topic = Topic.query.filter_by(id=form.topic.data).first()
speaker = speaker_by_name_or_number(form.speaker_name.data, topic.event.id)
if topic is not None and speaker is not None:
if speaker.count_active(topic) == 0:
statement = Statement(speaker.id, topic.id)
db.session.add(statement)
db.session.commit()
return redirect(url_for(".topic_show", id=topic.id))
return render_layout("admin_statement_new.html", form=form)
@admin.route("/statement/done")
......
......@@ -3,5 +3,5 @@
{% block admin_title %}Add Statement{% endblock %}
{% block content %}
{{ render_form(form, action_url=url_for(".statement_new"), btn_list=[("","Add Statement","add_statement"), ("redl-btn-meta","Add Meta","add_meta_statement")]) }}
{{ render_form(form, action_url=url_for(".statement_new"), btn_list=[("","Add Statement","add_statement"), ("mdl-button--colored","Add Meta","add_meta_statement")]) }}
{% endblock %}
......@@ -47,7 +47,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", btn_list=[("","Add Statement","add_statement"), ("redl-btn-meta","Add Meta","add_meta_statement")] ) }}
{{ 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"), ("mdl-button--colored","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 class="rede-list-no-bullet">
{% if topic.sorted_statements()|length() > 0 %}
......
......@@ -135,10 +135,10 @@
<div class="{{ action_class }}">
{% 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>
<button type="submit" class="{{ btn_class }} {{ this_btn_class }}" name="submit" value="{{ btn_value }}">{{ action_text }}</button>
{% endfor %}
{% else %}
<button type="submit" class="{{ btn_class }}", value="{{ btn_value }}">{{ action_text }}</button>
<button type="submit" class="{{ btn_class }}" value="{{ btn_value }}">{{ action_text }}</button>
{% endif %}
</div>
......
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