Files
surveybox/surveybox/web/templates/admin_appearance.html
T
marco.morath 6c5175d2f1
CI / audit (push) Skipped
CI / checks (push) Successful in 4m3s
CI / image (push) Successful in 1m11s
v1.0.0
2026-11-26 10:44:32 +01:00

163 lines
10 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% block title %}{{ _('Design') }} · {{ appearance.name }}{% endblock %}
{% block content %}
<p><a href="/admin/settings">← {{ _('Settings') }}</a></p>
<h1>{{ _('Design') }}</h1>
<section class="card" id="logo">
<h2>{{ _('Logo') }}</h2>
{% if logo_error %}<p class="alert error" role="alert">{{ _(logo_error) }}</p>{% endif %}
<div class="logo-preview">
{% if brand.custom %}
<img src="{{ brand.url('logo') }}" alt="{{ _('Current logo') }}">
<img class="logo-preview-icon" src="{{ brand.url('favicon') }}" alt="{{ _('Icon in the browser tab') }}" width="32" height="32">
{% if brand.dark %}<span class="dark-sample"><img src="{{ brand.url('logo_dark') }}" alt="{{ _('Logo for the dark display') }}"></span>{% endif %}
{% else %}
<img src="{{ url_for('static', path='img/logo.svg').path }}" alt="{{ _('Surveybox logo') }}" width="64" height="64">
<span class="hint">{{ _('The Surveybox logo is shown.') }}</span>
{% endif %}
</div>
<form method="post" action="/admin/settings/logo" enctype="multipart/form-data" class="form">
{{ csrf_field(request) }}
<label for="logo">{{ _('Own logo') }}</label>
<input id="logo" name="logo" type="file" accept=".png,.jpg,.jpeg,.webp" required>
<p class="hint">{{ _('PNG, JPEG or WebP, at most 5 MB; ideally with a transparent background. It appears in the header of every page and in exports. The icon in the browser tab is made from it; a square logo works best there.') }}</p>
<button type="submit">{{ _('Upload logo') }}</button>
</form>
{% if brand.custom %}
<form method="post" action="/admin/settings/logo" enctype="multipart/form-data" class="form">
{{ csrf_field(request) }}
<input type="hidden" name="variant" value="dark">
<label for="logo_dark">{{ _('Logo for the dark display') }}</label>
<input id="logo_dark" name="logo" type="file" accept=".png,.jpg,.jpeg,.webp" required>
<p class="hint">{{ _('Optional, e.g. with light lettering. Shown when the browser uses the dark display (or the display is set to dark below).') }}</p>
<button type="submit" class="secondary">{{ _('Upload dark logo') }}</button>
</form>
<div class="inline-actions">
{% if brand.dark %}
<form method="post" action="/admin/settings/logo/remove" class="inline">
{{ csrf_field(request) }}<input type="hidden" name="variant" value="dark">
<button type="submit" class="secondary">{{ _('Remove dark logo') }}</button>
</form>
{% endif %}
<form method="post" action="/admin/settings/logo/remove" class="inline">
{{ csrf_field(request) }}
<button type="submit" class="secondary">{{ _('Use the Surveybox logo again') }}</button>
</form>
</div>
{% endif %}
</section>
<section class="card" id="settings">
<h2>{{ _('Name, colours and texts') }}</h2>
{% for message in errors %}<p class="alert error" role="alert">{{ _(message) }}</p>{% endfor %}
{% for message, ratio in contrast_warnings %}<p class="alert warn" role="status">{{ _(message, ratio=ratio) }}</p>{% endfor %}
<form method="post" action="/admin/appearance" class="form">
{{ csrf_field(request) }}
<label for="name">{{ _('Name of the application') }}</label>
<input type="text" id="name" name="name" maxlength="60" required value="{{ look.name }}">
<p class="hint">{{ _('Appears in the header (without own logo), in the browser tab and in emails.') }}</p>
<label for="mode">{{ _('Display') }}</label>
<select id="mode" name="mode">
<option value="auto" {% if look.mode == 'auto' %}selected{% endif %}>{{ _('Automatic (as set in the browser)') }}</option>
<option value="light" {% if look.mode == 'light' %}selected{% endif %}>{{ _('Always light') }}</option>
<option value="dark" {% if look.mode == 'dark' %}selected{% endif %}>{{ _('Always dark') }}</option>
</select>
{% set color_fields = [
('primary', _('Primary colour'), _('Buttons and links.'), look.primary, defaults.primary),
('accent', _('Accent colour'), _('Markings: bars in the results, stars, selected tiles, info boxes.'), look.accent, look.primary or defaults.primary),
('background', _('Background colour'), _('Page background; cards stay white on light backgrounds.'), look.background, defaults.bg),
('text', _('Text colour'), '', look.text, defaults.text),
] %}
{% for key, label, hint, value, fallback in color_fields %}
<label for="{{ key }}">{{ label }}</label>
<div class="color-field">
<input type="color" id="{{ key }}" name="{{ key }}" value="{{ value or fallback }}">
<label class="check"><input type="checkbox" name="{{ key }}_default" value="on" {% if not value %}checked{% endif %}> {{ _('Standard') }}</label>
</div>
{% if hint %}<p class="hint">{{ hint }}</p>{% endif %}
{% endfor %}
<p class="hint">{{ _('A chosen colour only applies when “Standard” is not ticked. The colours apply to the light display; the dark display derives readable shades of the primary and accent colour. Contrast is checked against WCAG 2.1 (level AA); if it is too low, a warning appears above.') }}</p>
<label for="welcome">{{ _('Text on the start page') }}</label>
<textarea id="welcome" name="welcome" rows="4" maxlength="2000">{{ look.welcome }}</textarea>
<p class="hint">{{ _('Shown to everyone on the start page, e.g. who runs this service. Plain text.') }}</p>
<label for="footer_text">{{ _('Footer text') }}</label>
<input type="text" id="footer_text" name="footer_text" maxlength="300" value="{{ look.footer_text }}">
<h3 id="legal">{{ _('Legal notice and privacy policy') }}</h3>
<p class="hint">{{ _('Enter a link to an existing page, or the text itself; then Surveybox shows it at %(imprint)s and %(privacy)s. If both are filled in, the link applies. Both appear in the footer of every page, also on forms embedded in other pages.', imprint='/imprint', privacy='/privacy') }}</p>
<label for="imprint_url">{{ _('Link to the legal notice') }}</label>
<input id="imprint_url" name="imprint_url" type="url" maxlength="500" placeholder="https://" value="{{ look.imprint_url }}">
<label for="imprint_text">{{ _('Text of the legal notice') }}</label>
<textarea id="imprint_text" name="imprint_text" rows="10" maxlength="20000">{{ look.imprint_text }}</textarea>
<label for="privacy_url">{{ _('Link to the privacy policy') }}</label>
<input id="privacy_url" name="privacy_url" type="url" maxlength="500" placeholder="https://" value="{{ look.privacy_url }}">
<label for="privacy_text">{{ _('Text of the privacy policy') }}</label>
<textarea id="privacy_text" name="privacy_text" rows="10" maxlength="20000">{{ look.privacy_text }}</textarea>
<p class="hint">{{ _('Simple Markdown: ## for headings, - for lists, **bold**, [text](https://…). Every line stays a line; an empty line starts a new paragraph. HTML is shown as text.') }} <a href="/help/administration#impressum-und-datenschutzerklärung">{{ _('Template for the legal notice') }}</a></p>
<label for="css">{{ _('Own CSS') }}</label>
<textarea id="css" name="css" rows="6" maxlength="20000" class="code" spellcheck="false">{{ look.css }}</textarea>
<p class="hint">{{ _('For special cases; loaded after all other styles. External addresses are blocked by the security settings of the page, so fonts and images must come from this server.') }}</p>
<button type="submit">{{ _('Save') }}</button>
</form>
<ul class="swatches" aria-label="{{ _('Colours in use') }}">
<li><span class="swatch swatch-primary"></span>{{ _('Primary colour') }}</li>
<li><span class="swatch swatch-accent"></span>{{ _('Accent colour') }}</li>
<li><span class="swatch swatch-bg"></span>{{ _('Background colour') }}</li>
<li><span class="swatch swatch-surface"></span>{{ _('Cards') }}</li>
<li><span class="swatch swatch-text"></span>{{ _('Text colour') }}</li>
<li><span class="swatch swatch-muted"></span>{{ _('Hints') }}</li>
</ul>
<form method="post" action="/admin/appearance/reset" class="form">
{{ csrf_field(request) }}
<button type="submit" class="secondary">{{ _('Reset name, colours and texts') }}</button>
</form>
</section>
<section class="card" id="font">
<h2>{{ _('Font') }}</h2>
{% if look.font_format %}
<p>{{ _('An own font is used (%(format)s).', format=look.font_format | upper) }}</p>
{% else %}
<p class="hint">{{ _('The system font of each device is used.') }}</p>
{% endif %}
<form method="post" action="/admin/appearance/font" enctype="multipart/form-data" class="form">
{{ csrf_field(request) }}
<label for="font_file">{{ _('Font file') }}</label>
<input id="font_file" name="font" type="file" accept=".woff2,.woff,.ttf,.otf" required>
<p class="hint">{{ _('WOFF2 (recommended), WOFF, TTF or OTF, at most 2 MB, for example Open Sans. The font is delivered by this server, never loaded from elsewhere. Make sure its licence allows use on a website.') }}</p>
<button type="submit">{{ _('Upload font') }}</button>
</form>
{% if look.font_format %}
<form method="post" action="/admin/appearance/font/remove" class="form">
{{ csrf_field(request) }}
<button type="submit" class="secondary">{{ _('Use the system font again') }}</button>
</form>
{% endif %}
</section>
<section class="card" id="transfer">
<h2>{{ _('Export and import') }}</h2>
<p>{{ _('The design – settings, logos and font – as one file, e.g. to transfer it to a second instance.') }}</p>
<p><a class="button secondary" href="/admin/appearance/export" download>{{ _('Export design') }}</a></p>
<form method="post" action="/admin/appearance/import" enctype="multipart/form-data" class="form">
{{ csrf_field(request) }}
<label for="design">{{ _('Import design') }}</label>
<input id="design" name="design" type="file" accept=".json,application/json" required>
<p class="hint">{{ _('Replaces name, colours, texts and own CSS. Logo and font are replaced only if the file contains them. Images are checked and re-encoded as with an upload.') }}</p>
<button type="submit">{{ _('Import') }}</button>
</form>
</section>
{% endblock %}