Add turn publish button

This commit is contained in:
Tim Van Baak 2020-04-29 17:11:12 -07:00
parent 671770538c
commit 7488a8ca79
2 changed files with 15 additions and 3 deletions

View File

@ -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):

View File

@ -36,6 +36,12 @@
</li>
{% endfor %}
</ul>
{% if publish_form %}
<form id="publish-turn-form" action="" method="post" novalidate>
{{ publish_form.hidden_tag() }}
<p>{{ publish_form.submit() }}</p>
</form>
{% endif %}
{% endblock %}
{% set template_content_blocks = template_content_blocks + [self.bl_editor()] %}
{% endif %}