some slight ui improvements

This commit is contained in:
mst 2024-11-26 15:07:40 +03:00
parent f416e5cf9e
commit aae198496d
4 changed files with 28 additions and 17 deletions

View file

@ -3,7 +3,7 @@
{% set emojis_link = 'active' %} {% set emojis_link = 'active' %}
{% block _content %} {% block _content %}
<h2 id="customEmojis" class="mb-3 fw-normal">Custom emojis</h2> <h2 id="customEmojis" class="mb-3 fw-normal">Custom emojis</h2>
<h3 class="fw-light">Upload</h3> <h3 class="fw-light mb-3">Upload</h3>
<form hx-post="{{ url_for('api.uploadEmoji') }}" hx-target="#response-container" hx-swap="none" hx-encoding="multipart/form-data"> <form hx-post="{{ url_for('api.uploadEmoji') }}" hx-target="#response-container" hx-swap="none" hx-encoding="multipart/form-data">
<div> <div>
<label for="emoji" class="form-label">Upload an emoji</label> <label for="emoji" class="form-label">Upload an emoji</label>
@ -18,13 +18,13 @@
</div> </div>
</form> </form>
<hr> <hr>
<form hx-post="{{ url_for('api.uploadEmojiPack') }}" hx-target="#response-container" hx-swap="none" hx-encoding="multipart/form-data"> <form id="pack-form" hx-post="{{ url_for('api.uploadEmojiPack') }}" hx-target="#response-container" hx-swap="none" hx-encoding="multipart/form-data">
<div> <div>
<label for="emoji_archive" class="form-label">Upload emoji pack</label> <label for="emoji_archive" class="form-label">Upload emoji pack</label>
<input class="form-control" type="file" id="emoji_archive" name="emoji_archive"> <input class="form-control" type="file" id="emoji_archive" name="emoji_archive">
<p class="form-text mb-0">Supported archive formats: <strong>.zip, .tar, .tar.gz, .tar.bz2, .tar.xz</strong></p> <p class="form-text mb-0">Supported archive formats: <strong>.zip, .tar, .tar.gz, .tar.bz2, .tar.xz</strong></p>
</div> </div>
<div class="mb-4"> <div class="mb-5">
<button type="submit" class="btn btn-primary mt-3" id="uploadEmojiPack"> <button type="submit" class="btn btn-primary mt-3" id="uploadEmojiPack">
<span class="spinner-border spinner-border-sm htmx-indicator" aria-hidden="true"></span> <span class="spinner-border spinner-border-sm htmx-indicator" aria-hidden="true"></span>
<span class="visually-hidden" role="status">Loading...</span> <span class="visually-hidden" role="status">Loading...</span>
@ -32,8 +32,9 @@
</button> </button>
</div> </div>
</form> </form>
<h3 class="fw-light">Manage</h3> <h3 class="fw-light mb-3">Manage</h3>
<h4 class="fw-light">Emojis</h4> <h4 class="fw-light">Emojis</h4>
{% if emojis %}
<div class="table-responsive"> <div class="table-responsive">
<table id="emojiTable" class="table align-middle"> <table id="emojiTable" class="table align-middle">
<thead> <thead>
@ -51,6 +52,9 @@
</tbody> </tbody>
</table> </table>
</div> </div>
{% else %}
<p class="text-center">No emojis uploaded</p>
{% endif %}
<h4 class="fw-light mt-3">Emoji packs</h4> <h4 class="fw-light mt-3">Emoji packs</h4>
<p class="text-body-secondary small">Please note that if meta.json is not found in the archive, preview images are selected by first emoji name to appear alphabetically, so they may not be accurate sometimes</p> <p class="text-body-secondary small">Please note that if meta.json is not found in the archive, preview images are selected by first emoji name to appear alphabetically, so they may not be accurate sometimes</p>
{% if packs %} {% if packs %}
@ -70,7 +74,7 @@
</thead> </thead>
<tbody id="packs"> <tbody id="packs">
{% for pack in packs %} {% for pack in packs %}
{% with json_pack = json_pack %} {% with json_pack = json_pack, index = loop.index - 1 %}
{% include 'snippets/admin/packRow.html' %} {% include 'snippets/admin/packRow.html' %}
{% endwith %} {% endwith %}
{% endfor %} {% endfor %}

View file

@ -14,47 +14,51 @@
<input type="text" id="anonName" name="anonName" value="{{ cfg.anonName }}" class="form-control"> <input type="text" id="anonName" name="anonName" value="{{ cfg.anonName }}" class="form-control">
<p class="form-text">This name will be used for questions asked to you by anonymous users</p> <p class="form-text">This name will be used for questions asked to you by anonymous users</p>
</div> </div>
<div class="form-check mb-2"> <div class="form-check form-switch mb-2">
<input <input
class="form-check-input" class="form-check-input"
type="checkbox" type="checkbox"
name="_lockInbox" name="_lockInbox"
id="_lockInbox" id="_lockInbox"
value="{{ cfg.lockInbox }}" value="{{ cfg.lockInbox }}"
{% if cfg.lockInbox == true %}checked{% endif %}> role="switch"
{% if cfg.lockInbox %}checked{% endif %}>
<input type="hidden" id="lockInbox" name="lockInbox" value="{{ cfg.lockInbox }}"> <input type="hidden" id="lockInbox" name="lockInbox" value="{{ cfg.lockInbox }}">
<label for="_lockInbox" class="form-check-label">Lock inbox and don't allow new questions</label> <label for="_lockInbox" class="form-check-label">Lock inbox and don't allow new questions</label>
</div> </div>
<div class="form-check mb-2"> <div class="form-check form-switch mb-2">
<input <input
class="form-check-input" class="form-check-input"
type="checkbox" type="checkbox"
name="_allowAnonQuestions" name="_allowAnonQuestions"
id="_allowAnonQuestions" id="_allowAnonQuestions"
value="{{ cfg.allowAnonQuestions }}" value="{{ cfg.allowAnonQuestions }}"
{% if cfg.allowAnonQuestions == true %}checked{% endif %}> role="switch"
{% if cfg.allowAnonQuestions %}checked{% endif %}>
<input type="hidden" id="allowAnonQuestions" name="allowAnonQuestions" value="{{ cfg.allowAnonQuestions }}"> <input type="hidden" id="allowAnonQuestions" name="allowAnonQuestions" value="{{ cfg.allowAnonQuestions }}">
<label for="_allowAnonQuestions" class="form-check-label">Allow anonymous questions</label> <label for="_allowAnonQuestions" class="form-check-label">Allow anonymous questions</label>
</div> </div>
<div class="form-check mb-2"> <div class="form-check form-switch mb-2">
<input <input
class="form-check-input" class="form-check-input"
type="checkbox" type="checkbox"
name="_noDeleteConfirm" name="_noDeleteConfirm"
id="_noDeleteConfirm" id="_noDeleteConfirm"
value="{{ cfg.noDeleteConfirm }}" value="{{ cfg.noDeleteConfirm }}"
{% if cfg.noDeleteConfirm == true %}checked{% endif %}> role="switch"
{% if cfg.noDeleteConfirm %}checked{% endif %}>
<input type="hidden" id="noDeleteConfirm" name="noDeleteConfirm" value="{{ cfg.noDeleteConfirm }}"> <input type="hidden" id="noDeleteConfirm" name="noDeleteConfirm" value="{{ cfg.noDeleteConfirm }}">
<label for="_noDeleteConfirm" class="form-check-label">Disable confirmation when deleting questions</label> <label for="_noDeleteConfirm" class="form-check-label">Disable confirmation when deleting questions</label>
</div> </div>
<div class="form-check mb-3"> <div class="form-check form-switch mb-3">
<input <input
class="form-check-input" class="form-check-input"
type="checkbox" type="checkbox"
name="_showQuestionCount" name="_showQuestionCount"
id="_showQuestionCount" id="_showQuestionCount"
value="{{ cfg.showQuestionCount }}" value="{{ cfg.showQuestionCount }}"
{% if cfg.showQuestionCount == true %}checked{% endif %}> role="switch"
{% if cfg.showQuestionCount %}checked{% endif %}>
<input type="hidden" id="showQuestionCount" name="showQuestionCount" value="{{ cfg.showQuestionCount }}"> <input type="hidden" id="showQuestionCount" name="showQuestionCount" value="{{ cfg.showQuestionCount }}">
<label for="_showQuestionCount" class="form-check-label">Show question count in homepage</label> <label for="_showQuestionCount" class="form-check-label">Show question count in homepage</label>
</div> </div>

View file

@ -1,5 +1,6 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Admin Login{% endblock %} {% block title %}Admin Login{% endblock %}
{% set loginLink = 'active' %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col-lg-4 m-auto mt-5"> <div class="col-lg-4 m-auto mt-5">

View file

@ -1,7 +1,7 @@
<div class="card-text markdown-content"> <div class="card-text markdown-content">
{% if question.cw %} {% if question.cw %}
<p class="text-center mb-2 fw-bold cw-text">{{ question.cw }}</p> <p class="text-center mb-2 fw-bold cw-text">{{ question.cw }}</p>
<div class="collapse question-cw" id="question-cw-{{ question.id }}"> <div class="collapse question-cw question-{{ question.id }}" id="question-cw-{{ question.id }}">
{{ question.content | render_markdown }} {{ question.content | render_markdown }}
</div> </div>
<button class="z-0 cw-btn btn btn-sm btn-secondary shadow text-center w-100 sticky-bottom" type="button" data-bs-toggle="collapse" data-bs-target="#question-cw-{{ question.id }}" aria-expanded="false" aria-controls="question-cw-{{ question.id }}"> <button class="z-0 cw-btn btn btn-sm btn-secondary shadow text-center w-100 sticky-bottom" type="button" data-bs-toggle="collapse" data-bs-target="#question-cw-{{ question.id }}" aria-expanded="false" aria-controls="question-cw-{{ question.id }}">
@ -9,6 +9,8 @@
<span class="text-body-secondary cw-btn-chars">({{ len(question.content) }} characters)</span> <span class="text-body-secondary cw-btn-chars">({{ len(question.content) }} characters)</span>
</button> </button>
{% else %} {% else %}
{{ question.content | render_markdown }} <div class="question-{{ question.id }}">
{{ question.content | render_markdown }}
</div>
{% endif %} {% endif %}
</div> </div>