From 7488a8ca7913350cf449bf2819708eb10818116a Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Wed, 29 Apr 2020 17:11:12 -0700 Subject: [PATCH] Add turn publish button --- amanuensis/server/session/__init__.py | 12 +++++++++--- amanuensis/server/session/session.root.jinja | 6 ++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/amanuensis/server/session/__init__.py b/amanuensis/server/session/__init__.py index d186bfb..8191e52 100644 --- a/amanuensis/server/session/__init__.py +++ b/amanuensis/server/session/__init__.py @@ -25,7 +25,8 @@ from amanuensis.server.helpers import ( from .forms import ( LexiconCharacterForm, - LexiconReviewForm) + LexiconReviewForm, + LexiconPublishTurnForm) from .settings import LexiconConfigForm from .editor import load_editor, new_draft, update_draft @@ -36,7 +37,7 @@ bp_session = Blueprint('session', __name__, template_folder='.') -@bp_session.route('/', methods=['GET']) +@bp_session.route('/', methods=['GET', 'POST']) @lexicon_param @player_required def session(name): @@ -54,11 +55,16 @@ def session(name): for char in g.lexicon.cfg.character.values(): if char.player == current_user.uid: characters.append(char) + form = LexiconPublishTurnForm() + if form.validate_on_submit(): + attempt_publish(g.lexicon) + return redirect(url_for('lexicon.contents', name=name)) return render_template( 'session.root.jinja', ready_articles=drafts, approved_articles=approved, - characters=characters) + characters=characters, + publish_form=form) def edit_character(name, form, character): diff --git a/amanuensis/server/session/session.root.jinja b/amanuensis/server/session/session.root.jinja index c0605c5..7b8785d 100644 --- a/amanuensis/server/session/session.root.jinja +++ b/amanuensis/server/session/session.root.jinja @@ -36,6 +36,12 @@ {% endfor %} +{% if publish_form %} +
+ {{ publish_form.hidden_tag() }} +

{{ publish_form.submit() }}

+
+{% endif %} {% endblock %} {% set template_content_blocks = template_content_blocks + [self.bl_editor()] %} {% endif %}