From 1b5ac23b77e70494f4eb72949dc7deece44c07e6 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Sun, 29 Aug 2021 15:24:42 -0700 Subject: [PATCH] tmp --- .../server/lexicon/settings/__init__.py | 22 +++ amanuensis/server/lexicon/settings/forms.py | 0 .../server/lexicon/settings/settings.jinja | 125 ++++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 amanuensis/server/lexicon/settings/__init__.py create mode 100644 amanuensis/server/lexicon/settings/forms.py create mode 100644 amanuensis/server/lexicon/settings/settings.jinja diff --git a/amanuensis/server/lexicon/settings/__init__.py b/amanuensis/server/lexicon/settings/__init__.py new file mode 100644 index 0000000..f15e170 --- /dev/null +++ b/amanuensis/server/lexicon/settings/__init__.py @@ -0,0 +1,22 @@ +from typing import Optional +import uuid + +from flask import Blueprint, render_template, url_for, g, flash +from flask_login import current_user +from werkzeug.utils import redirect + +from amanuensis.backend import charq +from amanuensis.db import Character +from amanuensis.server.helpers import editor_required, lexicon_param, player_required + +# from .forms import CharacterCreateForm + + +bp = Blueprint("settings", __name__, url_prefix="/settings", template_folder=".") + + +@bp.get("/") +@lexicon_param +@editor_required +def page(name): + return render_template("settings.jinja", name=name) diff --git a/amanuensis/server/lexicon/settings/forms.py b/amanuensis/server/lexicon/settings/forms.py new file mode 100644 index 0000000..e69de29 diff --git a/amanuensis/server/lexicon/settings/settings.jinja b/amanuensis/server/lexicon/settings/settings.jinja new file mode 100644 index 0000000..9b49c9c --- /dev/null +++ b/amanuensis/server/lexicon/settings/settings.jinja @@ -0,0 +1,125 @@ +{% extends "lexicon.jinja" %} +{% block title %}Edit | {{ lexicon_title }}{% endblock %} + +{% block main %} +

+ + +

+ Id: {{ g.lexicon.lid }}
+ Name: {{ g.lexicon.cfg.name }}
+ Created: {{ g.lexicon.cfg.time.created|asdate }}
+ Completed: {{ g.lexicon.cfg.time.completed|asdate }}
+ Players: + {% for uid in g.lexicon.cfg.join.joined %} + {{ uid|user_attr('username') }}{% if not loop.last %},{% endif %} + {% endfor %}
+ Characters: + {% for char in g.lexicon.cfg.character.values() %} + {{ char.name }}{% if char.player %} + ({{ char.player|user_attr('username') }}){% endif %} + {% if not loop.last %},{% endif %} + {% endfor %}
+

+
+ {% for log_entry in g.lexicon.cfg.log %} + [{{ log_entry[0]|asdate }}] {{ log_entry[1] }}
+ {% endfor %} +
+{% endblock %} + +{% macro number_setting(field) %} +{{ field(autocomplete="off", class_="smallnumber") }} +{{ field.label }}
+{% for error in field.errors %} +{{ error }}
+{% endfor %} + +{% endmacro %} +{% macro flag_setting(field) %} +{{ field() }} +{{ field.label }}
+{% endmacro %} + +{% block settings %} +
+ {{ form.hidden_tag() }} + +

General

+

+ {{ form.title.label }}:
+ {{ form.title(autocomplete="off", size=32, style="width:100%") }}
+ {{ form.editor.label }}: {{ form.editor(autocomplete="off") }}
+ {% for error in form.editor.errors %} + {{ error }}
+ {% endfor %} + {{ form.prompt.label }}: {{ form.prompt(class_="fullwidth") }} + {% for error in form.prompt.errors %} + {{ error }}
+ {% endfor %} +

+ +

Game Progress

+

+ {{ number_setting(form.turnCurrent) }} + {{ number_setting(form.turnMax) }} + {{ form.articleIndexList.label }}:
+ {{ form.articleIndexList(class_="fullwidth", rows=10) }} + {% for error in form.articleIndexList.errors %} + {{ error }}
+ {% endfor %} + {{ number_setting(form.articleIndexCapacity) }} + {{ form.turnAssignment.label }}:
+ {{ form.turnAssignment(class_="fullwidth", rows=10) }} +

+ +

Visibility and Joining

+

+ {{ flag_setting(form.joinPublic) }} + {{ flag_setting(form.joinOpen) }} + {{ form.joinPassword(autocomplete="off") }} + {{ form.joinPassword.label }}
+ {{ number_setting(form.joinMaxPlayers) }} + {{ number_setting(form.joinCharsPerPlayer) }} +

+ +

Turn Publishing

+

+ {{ flag_setting(form.publishNotifyEditorOnReady) }} + {{ flag_setting(form.publishNotifyPlayerOnReject) }} + {{ flag_setting(form.publishNotifyPlayerOnAccept) }} + {{ form.publishDeadlines(autocomplete="off") }} + {{ form.publishDeadlines.label }}
+ {{ flag_setting(form.publishAsap) }} + {% for error in form.publishDeadlines.errors %} + {{ error }}
+ {% endfor %} + {{ flag_setting(form.publishBlockOnReady) }} + {{ number_setting(form.publishQuorum) }} +

+ +

Article Requirements

+

+ {{ flag_setting(form.articleCitationAllowSelf) }} + {{ number_setting(form.articleCitationMinExtant)}} + {{ number_setting(form.articleCitationMaxExtant)}} + {{ number_setting(form.articleCitationMinPhantom)}} + {{ number_setting(form.articleCitationMaxPhantom)}} + {{ number_setting(form.articleCitationMinTotal)}} + {{ number_setting(form.articleCitationMaxTotal)}} + {{ number_setting(form.articleCitationMinChars)}} + {{ number_setting(form.articleCitationMaxChars)}} + {{ number_setting(form.articleWordLimitSoft)}} + {{ number_setting(form.articleWordLimitHard)}} + {{ flag_setting(form.articleAddendumAllowed) }} + {{ number_setting(form.articleAddendumMax) }} +

+ +

{{ form.submit() }}

+
+{% for message in get_flashed_messages() %} +{{ message }}
+{% endfor %} +{% endblock %} +{% set template_content_blocks = [self.info(), self.settings()] %} \ No newline at end of file