Semantic HTML and post feed #23

Merged
Jaculabilis merged 10 commits from tvb/post-feed into develop 2021-10-02 00:18:32 +00:00
4 changed files with 6 additions and 1 deletions
Showing only changes of commit d172848231 - Show all commits

View File

@ -10,6 +10,7 @@
{% endmacro %} {% endmacro %}
{% block main %} {% block main %}
{% if current_lexicon.allow_post %}
<section> <section>
<form action="" method="post" novalidate> <form action="" method="post" novalidate>
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
@ -17,7 +18,7 @@
<p>{{ form.submit() }}</p> <p>{{ form.submit() }}</p>
</form> </form>
</section> </section>
{% endif %}
{% for post in new_posts %} {% for post in new_posts %}
{{ make_post(post, True) }} {{ make_post(post, True) }}
{% endfor %} {% endfor %}

View File

@ -89,6 +89,7 @@ def setup(lexicon_name):
form.turn_count.data = lexicon.turn_count form.turn_count.data = lexicon.turn_count
form.player_limit.data = lexicon.player_limit form.player_limit.data = lexicon.player_limit
form.character_limit.data = lexicon.character_limit form.character_limit.data = lexicon.character_limit
form.allow_post.data = lexicon.allow_post
return render_template( return render_template(
"settings.jinja", "settings.jinja",
lexicon_name=lexicon_name, lexicon_name=lexicon_name,
@ -109,6 +110,7 @@ def setup(lexicon_name):
lexicon.turn_count = form.turn_count.data lexicon.turn_count = form.turn_count.data
lexicon.player_limit = form.player_limit.data lexicon.player_limit = form.player_limit.data
lexicon.character_limit = form.character_limit.data lexicon.character_limit = form.character_limit.data
lexicon.allow_post = form.allow_post.data
g.db.session.commit() # TODO refactor into backend g.db.session.commit() # TODO refactor into backend
flash("Settings saved") flash("Settings saved")
return redirect( return redirect(

View File

@ -49,6 +49,7 @@ class SetupSettingsForm(FlaskForm):
widget=NumberInput(), widget=NumberInput(),
validators=[Optional()], validators=[Optional()],
) )
allow_post = BooleanField("Allow players to make posts")
submit = SubmitField("Submit") submit = SubmitField("Submit")

View File

@ -80,6 +80,7 @@
<p> <p>
{{ number_setting(form.character_limit) }} {{ number_setting(form.character_limit) }}
</p> </p>
<p>{{ flag_setting(form.allow_post) }}</p>
<p>{{ form.submit() }}</p> <p>{{ form.submit() }}</p>
</form> </form>
{% for message in get_flashed_messages() %} {% for message in get_flashed_messages() %}