From d1728482315ef4eb7ac60067c965cf8b1ea7f188 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Fri, 1 Oct 2021 16:53:18 -0700 Subject: [PATCH] Respect lexicon post enable setting --- amanuensis/server/lexicon/posts/posts.jinja | 3 ++- amanuensis/server/lexicon/settings/__init__.py | 2 ++ amanuensis/server/lexicon/settings/forms.py | 1 + amanuensis/server/lexicon/settings/settings.jinja | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/amanuensis/server/lexicon/posts/posts.jinja b/amanuensis/server/lexicon/posts/posts.jinja index 9683515..efc3059 100644 --- a/amanuensis/server/lexicon/posts/posts.jinja +++ b/amanuensis/server/lexicon/posts/posts.jinja @@ -10,6 +10,7 @@ {% endmacro %} {% block main %} +{% if current_lexicon.allow_post %}
{{ form.hidden_tag() }} @@ -17,7 +18,7 @@

{{ form.submit() }}

- +{% endif %} {% for post in new_posts %} {{ make_post(post, True) }} {% endfor %} diff --git a/amanuensis/server/lexicon/settings/__init__.py b/amanuensis/server/lexicon/settings/__init__.py index 12295be..975178f 100644 --- a/amanuensis/server/lexicon/settings/__init__.py +++ b/amanuensis/server/lexicon/settings/__init__.py @@ -89,6 +89,7 @@ def setup(lexicon_name): form.turn_count.data = lexicon.turn_count form.player_limit.data = lexicon.player_limit form.character_limit.data = lexicon.character_limit + form.allow_post.data = lexicon.allow_post return render_template( "settings.jinja", lexicon_name=lexicon_name, @@ -109,6 +110,7 @@ def setup(lexicon_name): lexicon.turn_count = form.turn_count.data lexicon.player_limit = form.player_limit.data lexicon.character_limit = form.character_limit.data + lexicon.allow_post = form.allow_post.data g.db.session.commit() # TODO refactor into backend flash("Settings saved") return redirect( diff --git a/amanuensis/server/lexicon/settings/forms.py b/amanuensis/server/lexicon/settings/forms.py index f7dfab1..e830527 100644 --- a/amanuensis/server/lexicon/settings/forms.py +++ b/amanuensis/server/lexicon/settings/forms.py @@ -49,6 +49,7 @@ class SetupSettingsForm(FlaskForm): widget=NumberInput(), validators=[Optional()], ) + allow_post = BooleanField("Allow players to make posts") submit = SubmitField("Submit") diff --git a/amanuensis/server/lexicon/settings/settings.jinja b/amanuensis/server/lexicon/settings/settings.jinja index ff7b151..cfc71d2 100644 --- a/amanuensis/server/lexicon/settings/settings.jinja +++ b/amanuensis/server/lexicon/settings/settings.jinja @@ -80,6 +80,7 @@

{{ number_setting(form.character_limit) }}

+

{{ flag_setting(form.allow_post) }}

{{ form.submit() }}

{% for message in get_flashed_messages() %}