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 ( from .forms import (
LexiconCharacterForm, LexiconCharacterForm,
LexiconReviewForm) LexiconReviewForm,
LexiconPublishTurnForm)
from .settings import LexiconConfigForm from .settings import LexiconConfigForm
from .editor import load_editor, new_draft, update_draft from .editor import load_editor, new_draft, update_draft
@ -36,7 +37,7 @@ bp_session = Blueprint('session', __name__,
template_folder='.') template_folder='.')
@bp_session.route('/', methods=['GET']) @bp_session.route('/', methods=['GET', 'POST'])
@lexicon_param @lexicon_param
@player_required @player_required
def session(name): def session(name):
@ -54,11 +55,16 @@ def session(name):
for char in g.lexicon.cfg.character.values(): for char in g.lexicon.cfg.character.values():
if char.player == current_user.uid: if char.player == current_user.uid:
characters.append(char) 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( return render_template(
'session.root.jinja', 'session.root.jinja',
ready_articles=drafts, ready_articles=drafts,
approved_articles=approved, approved_articles=approved,
characters=characters) characters=characters,
publish_form=form)
def edit_character(name, form, character): def edit_character(name, form, character):

View File

@ -36,6 +36,12 @@
</li> </li>
{% endfor %} {% endfor %}
</ul> </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 %} {% endblock %}
{% set template_content_blocks = template_content_blocks + [self.bl_editor()] %} {% set template_content_blocks = template_content_blocks + [self.bl_editor()] %}
{% endif %} {% endif %}