diff --git a/modules/admin.py b/modules/admin.py index a18f4e7a82cb1e0ea312985edd5d2bb3b4475073..d26ddf09391683d432daa152fe67e7fec0628f68 100644 --- a/modules/admin.py +++ b/modules/admin.py @@ -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") diff --git a/templates/admin_statement_new.html b/templates/admin_statement_new.html index 855059613c05f5d68fbe884426edf2d309d5ef14..ec6d8334b3920bfc9c32bd4bdf90cee5c075881d 100644 --- a/templates/admin_statement_new.html +++ b/templates/admin_statement_new.html @@ -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 %} diff --git a/templates/admin_topic_show.html b/templates/admin_topic_show.html index cc6c429f532f0f86bdbd859c6e6e39f60997202e..8c9e4fd1c6553ee063701ba42e0e2a8f39eeced0 100644 --- a/templates/admin_topic_show.html +++ b/templates/admin_topic_show.html @@ -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 %} diff --git a/templates/macros.html b/templates/macros.html index 655263b97dc268b85b6dcbfd138789a9e9b29f3c..4a2ac7e958bb48fbd0f285819a9c1789189c994f 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -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>