2022-02-27 18:00:50 +00:00
|
|
|
{% extends 'settings/layout.html' %}
|
|
|
|
{% load i18n %}
|
|
|
|
|
|
|
|
{% block title %}{% trans "Themes" %}{% endblock %}
|
|
|
|
|
|
|
|
{% block header %}{% trans "Themes" %}{% endblock %}
|
|
|
|
|
2022-02-28 17:43:31 +00:00
|
|
|
{% block breadcrumbs %}
|
|
|
|
<a class="subtitle help is-link" href="{% url 'settings-site' %}/#display">
|
|
|
|
{% trans "Set instance default theme" %}
|
|
|
|
</a>
|
|
|
|
{% endblock %}
|
|
|
|
|
2022-02-27 18:00:50 +00:00
|
|
|
{% block panel %}
|
|
|
|
{% if success %}
|
|
|
|
<div class="notification is-success is-light">
|
|
|
|
<span class="icon icon-check" aria-hidden="true"></span>
|
|
|
|
<span>
|
|
|
|
{% trans "Successfully added theme" %}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<section class="block">
|
2022-02-27 18:12:47 +00:00
|
|
|
<div class="notification content">
|
|
|
|
<h2 class="title is-5">{% trans "How to add a theme" %}</h2>
|
|
|
|
<ol>
|
|
|
|
<li>
|
2022-02-27 18:46:01 +00:00
|
|
|
{% trans "Copy the theme file into the <code>bookwyrm/static/css/themes</code> directory on your server from the command line." %}
|
2022-02-27 18:12:47 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
{% trans "Run <code>./bw-dev compilescss</code>." %}
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
{% trans "Add the file name using the form below to make it available in the application interface." %}
|
|
|
|
</li>
|
|
|
|
</ol>
|
2022-02-27 18:00:50 +00:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section class="block content">
|
2022-02-27 18:12:47 +00:00
|
|
|
<h2 class="title is-4">{% trans "Add theme" %}</h2>
|
2022-02-27 18:00:50 +00:00
|
|
|
|
|
|
|
{% if theme_form.errors %}
|
|
|
|
<div class="notification is-danger is-light">
|
|
|
|
<span class="icon icon-x" aria-hidden="true"></span>
|
|
|
|
<span>
|
|
|
|
{% trans "Unable to save theme" %}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<form
|
|
|
|
method="POST"
|
|
|
|
action="{% url 'settings-themes' %}"
|
|
|
|
class="box"
|
|
|
|
enctype="multipart/form-data"
|
|
|
|
>
|
2022-02-27 19:19:09 +00:00
|
|
|
{% if not choices %}
|
|
|
|
<div class="notification is-warning">
|
|
|
|
{% trans "No available theme files detected" %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
<fieldset {% if not choices %}disabled{% endif %}>
|
2022-02-27 18:00:50 +00:00
|
|
|
{% csrf_token %}
|
|
|
|
<div class="columns">
|
|
|
|
<div class="column is-half">
|
|
|
|
<label class="label" for="id_name">
|
|
|
|
{% trans "Theme name" %}
|
|
|
|
</label>
|
|
|
|
<div class="control">
|
|
|
|
{{ theme_form.name }}
|
|
|
|
{% include 'snippets/form_errors.html' with errors_list=theme_form.name.errors id="desc_name" %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="column">
|
2022-02-27 18:12:47 +00:00
|
|
|
<label class="label" for="id_path">
|
|
|
|
{% trans "Theme filename" %}
|
2022-02-27 18:00:50 +00:00
|
|
|
</label>
|
|
|
|
<div class="control">
|
2022-02-27 18:46:01 +00:00
|
|
|
<div class="select">
|
2022-02-27 19:19:09 +00:00
|
|
|
<select
|
|
|
|
name="path"
|
|
|
|
aria-describedby="desc_path"
|
|
|
|
class=""
|
|
|
|
id="id_path"
|
|
|
|
>
|
|
|
|
{% for choice in choices %}
|
|
|
|
<option value="{{ choice }}">
|
|
|
|
{{ choice }}
|
|
|
|
</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
2022-02-27 18:46:01 +00:00
|
|
|
</div>
|
2022-02-27 18:12:47 +00:00
|
|
|
{% include 'snippets/form_errors.html' with errors_list=theme_form.path.errors id="desc_path" %}
|
2022-02-27 18:00:50 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-02-27 18:12:47 +00:00
|
|
|
<button type="submit" class="button">{% trans "Add theme" %}</button>
|
2022-02-27 19:19:09 +00:00
|
|
|
</fieldset>
|
2022-02-27 18:00:50 +00:00
|
|
|
</form>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section class="block content">
|
|
|
|
<h2 class="title is-4">{% trans "Available Themes" %}</h2>
|
|
|
|
<div class="table-container">
|
|
|
|
<table class="table is-striped">
|
|
|
|
<tr>
|
|
|
|
<th>
|
|
|
|
{% trans "Theme name" %}
|
|
|
|
</th>
|
|
|
|
<th>
|
|
|
|
{% trans "File" %}
|
|
|
|
</th>
|
|
|
|
<th>
|
|
|
|
{% trans "Actions" %}
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
{% for theme in themes %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ theme.name }}</td>
|
2022-02-27 18:12:47 +00:00
|
|
|
<td><code>{{ theme.path }}</code></td>
|
2022-02-27 18:00:50 +00:00
|
|
|
<td>
|
2022-02-28 17:54:07 +00:00
|
|
|
<form method="POST" action="{% url 'settings-themes-delete' theme.id %}">
|
|
|
|
{% csrf_token %}
|
|
|
|
<button type="submit" class="button is-danger is-light is-small">
|
|
|
|
<span class="icon icon-x" aria-hideen="true"></span>
|
|
|
|
<span>{% trans "Remove theme" %}</span>
|
|
|
|
</button>
|
2022-02-27 18:00:50 +00:00
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
{% endblock %}
|