Adds theme instructions

This commit is contained in:
Mouse Reeve 2022-02-27 10:12:47 -08:00
parent 3dfbb3272e
commit cc015536fa
2 changed files with 22 additions and 23 deletions

View file

@ -466,9 +466,7 @@ class ThemeForm(CustomForm):
fields = ["name", "path"] fields = ["name", "path"]
widgets = { widgets = {
"name": forms.TextInput(attrs={"aria-describedby": "desc_name"}), "name": forms.TextInput(attrs={"aria-describedby": "desc_name"}),
"path": ClearableFileInputWithWarning( "path": forms.TextInput(attrs={"aria-describedby": "desc_path", "placeholder": _("example-theme.scss")}),
attrs={"aria-describedby": "desc_path"}
),
} }

View file

@ -16,21 +16,24 @@
{% endif %} {% endif %}
<section class="block"> <section class="block">
<div class="notification"> <div class="notification content">
<p> <h2 class="title is-5">{% trans "How to add a theme" %}</h2>
<strong>{% trans "Default theme:" %}</strong> {{ site.default_theme.name }} <ol>
</p> <li>
{% trans "Copy the theme file into the <code>bookwyrm/static/css/</code> directory on your server from the command line." %}
<p> </li>
<a href="{% url 'settings-site' %}#display"> <li>
{% trans "Set default theme" %} {% trans "Run <code>./bw-dev compilescss</code>." %}
</a> </li>
</p> <li>
{% trans "Add the file name using the form below to make it available in the application interface." %}
</li>
</ol>
</div> </div>
</section> </section>
<section class="block content"> <section class="block content">
<h2 class="title is-4">{% trans "Upload theme" %}</h2> <h2 class="title is-4">{% trans "Add theme" %}</h2>
{% if theme_form.errors %} {% if theme_form.errors %}
<div class="notification is-danger is-light"> <div class="notification is-danger is-light">
@ -60,17 +63,17 @@
</div> </div>
<div class="column"> <div class="column">
<label class="label" for="id_theme_file"> <label class="label" for="id_path">
{% trans "Theme file" %} {% trans "Theme filename" %}
</label> </label>
<div class="control"> <div class="control">
{{ theme_form.theme_file }} {{ theme_form.path }}
{% include 'snippets/form_errors.html' with errors_list=theme_form.theme_file.errors id="desc_theme_file" %} {% include 'snippets/form_errors.html' with errors_list=theme_form.path.errors id="desc_path" %}
</div> </div>
</div> </div>
</div> </div>
<button type="submit" class="button">{% trans "Upload theme" %}</button> <button type="submit" class="button">{% trans "Add theme" %}</button>
</form> </form>
</section> </section>
@ -92,13 +95,11 @@
{% for theme in themes %} {% for theme in themes %}
<tr> <tr>
<td>{{ theme.name }}</td> <td>{{ theme.name }}</td>
<td><code>{{ theme.theme_path }}</code></td> <td><code>{{ theme.path }}</code></td>
<td> <td>
{% if theme.theme_file %}
<form> <form>
<button type="submit" class="button is-danger is-light">{% trans "Delete" %}</button> <button type="submit" class="button is-danger is-light">{% trans "Remove theme" %}</button>
</form> </form>
{% endif %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}