amanuensis/amanuensis/server/session/session.editor.jinja

119 lines
3.5 KiB
Django/Jinja

{% if character and not article %}
{% set characters = [character] %}
{% endif %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Editor</title>
<link rel="stylesheet" href="{{ url_for('static', filename='page.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='editor.css') }}">
<script>
params = {
updateURL: "{{ url_for('session.editor_update', name=g.lexicon.cfg.name) }}",
{% if character %}
character: {{ jsonfmt(character) }},
{% else %}
character: null,
{% endif %}
{% if article %}
article: {
aid: {{ jsonfmt(article.aid) }},
status: {{ jsonfmt(article.status) }},
}
{% else %}
article: null
{% endif %}
};
</script>
<script type="text/javascript" src="{{ url_for('static', filename='editor.js') }}"></script>
</head>
<body>
<div id="wrapper">
<div id="editor-left" class="column">
<div class="contentblock">
{# Thin header bar #}
<div id="editor-header">
{# Header always includes backlink to lexicon #}
<a href="{{ url_for('session.session', name=g.lexicon.cfg.name) }}">
{{ g.lexicon.title }}
</a>
{# If article is not finalized, show button to submit and retract #}
{% if article and not article.status.approved %}
<button id="button-submit" onclick="submitArticle()">Submit article</button>
{% endif %}
{# Header always includes character/player info #}
<span>
<b>
{% if character %}
{{ character.name }} /
{% endif %}
{{ current_user.cfg.username }}
</b>
</span>
</div>
{# In load mode, `characters` is specified and `article` is #}
{# not, and the main body of the editor column contains a #}
{# list of articles that can be loaded. #}
{% for char in characters %}
<div id="editor-charselect">
<b>{{ char.name }}</b>
<ul>
{% for article in articles %}
{% if article.character == char.cid %}
<li>
<a href="{{ url_for('session.editor', name=g.lexicon.cfg.name, aid=article.aid) }}">
{{ article.title if article.title.strip() else "Untitled" }}
</a>
<span>
{% if not article.status.ready %}
[Draft]
{% elif not article.status.approved %}
[Pending]
{% else %}
[Approved]
{% endif %}
</span>
</li>
{% endif %}
{% endfor %}
<li>
<a href="{{ url_for('session.editor_new', name=g.lexicon.cfg.name, cid=char.cid) }}">
New
</a>
</li>
</ul>
</div>
{% endfor %}
{# In edit mode, `article` is specified and `characters` is #}
{# not, and the editor pane contains the article editor. #}
{% if article %}
<div id="editor-buttons">
Character literals:
<button>*</button>
<button>/</button>
<button>[</button>
<button>]</button>
<button>~</button>
</div>
<input id="editor-title" placeholder="Title" oninput="onContentChange()" disabled value="{{ article.title }}">
<textarea id="editor-content" class="fullwidth" oninput="onContentChange()" disabled>{{ article.contents }}</textarea>
{% endif %}
</div>
</div>
<div id="editor-right" class="column">
<div id="preview" class="contentblock">
<p>This editor requires Javascript to function.</p>
</div>
<div id="preview-citations" class="contentblock">
<p>&nbsp;</p>
</div>
<div id="preview-control" class="contentblock">
<p>&nbsp;</p>
</div>
</div>
</div>
</body>
</html>