Merge branch 'main' into celerybeat

This commit is contained in:
Mouse Reeve
2022-03-14 15:13:09 -07:00
137 changed files with 8256 additions and 5357 deletions

View File

@ -4,7 +4,19 @@
{% block header %}
{% trans "Add instance" %}
<a href="{% url 'settings-federation' %}" class="has-text-weight-normal help">{% trans "Back to instance list" %}</a>
{% endblock %}
{% block breadcrumbs %}
<nav class="breadcrumb subtitle" aria-label="breadcrumbs">
<ul>
<li><a href="{% url 'settings-federation' %}">{% trans "Federated Instances" %}</a></li>
<li class="is-active">
<a href="#" aria-current="page">
{% trans "Add instance" %}
</a>
</li>
</ul>
</nav>
{% endblock %}
{% block panel %}
@ -73,9 +85,13 @@
<label class="label" for="id_notes">
{% trans "Notes:" %}
</label>
<textarea name="notes" cols="40" rows="5" class="textarea" id="id_notes">
{{ form.notes.value|default:'' }}
</textarea>
<textarea
name="notes"
cols="40"
rows="5"
class="textarea"
id="id_notes"
>{{ form.notes.value|default:'' }}</textarea>
</div>
<button type="submit" class="button is-primary">

View File

@ -9,8 +9,26 @@
{% if server.status == "blocked" %}<span class="icon icon-x has-text-danger is-size-5" title="{% trans 'Blocked' %}"><span class="is-sr-only">{% trans "Blocked" %}</span></span>
{% endif %}
{% endblock %}
<a href="{% url 'settings-federation' %}" class="has-text-weight-normal help">{% trans "Back to list" %}</a>
{% block edit-button %}
<form name="reload" method="POST" action="{% url 'settings-federated-server-refresh' server.id %}">
{% csrf_token %}
<button class="button" type="submit">{% trans "Refresh data" %}</button>
</form>
{% endblock %}
{% block breadcrumbs %}
<nav class="breadcrumb subtitle" aria-label="breadcrumbs">
<ul>
<li><a href="{% url 'settings-federation' %}">{% trans "Federated Instances" %}</a></li>
<li class="is-active">
<a href="#" aria-current="page">
{{ server.server_name }}
</a>
</li>
</ul>
</nav>
{% endblock %}
{% block panel %}

View File

@ -4,7 +4,19 @@
{% block header %}
{% trans "Import Blocklist" %}
<a href="{% url 'settings-federation' %}" class="has-text-weight-normal help">{% trans "Back to instance list" %}</a>
{% endblock %}
{% block breadcrumbs %}
<nav class="breadcrumb subtitle" aria-label="breadcrumbs">
<ul>
<li><a href="{% url 'settings-federation' %}">{% trans "Federated Instances" %}</a></li>
<li class="is-active">
<a href="#" aria-current="page">
{% trans "Import Blocklist" %}
</a>
</li>
</ul>
</nav>
{% endblock %}
{% block panel %}

View File

@ -16,11 +16,11 @@
<ul>
{% url 'settings-federation' status='federated' as url %}
<li {% if request.path in url %}class="is-active" aria-current="page"{% endif %}>
<a href="{{ url }}">{% trans "Federated" %}</a>
<a href="{{ url }}">{% trans "Federated" %} ({{ federated_count }})</a>
</li>
{% url 'settings-federation' status='blocked' as url %}
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
<a href="{{ url }}">{% trans "Blocked" %}</a>
<a href="{{ url }}">{% trans "Blocked" %} ({{ blocked_count }})</a>
</li>
</ul>
</div>

View File

@ -86,6 +86,10 @@
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Site Settings" %}</a>
{% block site-subtabs %}{% endblock %}
</li>
<li>
{% url 'settings-themes' as url %}
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Themes" %}</a>
</li>
</ul>
{% endif %}
</nav>

View File

@ -18,8 +18,10 @@
{% endblock %}
{% block modal-footer %}
<button type="submit" class="button is-primary">{% trans "Set" %}</button>
<button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
<div class="buttons is-right is-flex-grow-1">
<button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
<button type="submit" class="button is-primary">{% trans "Set" %}</button>
</div>
{% endblock %}
{% block modal-form-close %}</form>{% endblock %}

View File

@ -0,0 +1,7 @@
{% extends 'snippets/filters_panel/filters_panel.html' %}
{% block filter_fields %}
{% include 'settings/users/username_filter.html' %}
{% include 'directory/community_filter.html' %}
{% include 'settings/users/server_filter.html' %}
{% endblock %}

View File

@ -30,7 +30,7 @@
</ul>
</div>
{% include 'settings/users/user_admin_filters.html' %}
{% include 'settings/reports/report_filters.html' %}
<div class="block">
{% if not reports %}

View File

@ -8,7 +8,7 @@
{% block site-subtabs %}
<ul class="menu-list">
<li><a href="#instance-info">{% trans "Instance Info" %}</a></li>
<li><a href="#images">{% trans "Images" %}</a></li>
<li><a href="#display">{% trans "Display" %}</a></li>
<li><a href="#footer">{% trans "Footer Content" %}</a></li>
<li><a href="#registration">{% trans "Registration" %}</a></li>
</ul>
@ -33,7 +33,12 @@
</div>
{% endif %}
<form action="{% url 'settings-site' %}" method="POST" class="content" enctype="multipart/form-data">
<form
action="{% url 'settings-site' %}"
method="POST"
class="content"
enctype="multipart/form-data"
>
{% csrf_token %}
<section class="block" id="instance_info">
<h2 class="title is-4">{% trans "Instance Info" %}</h2>
@ -68,20 +73,33 @@
<hr aria-hidden="true">
<section class="block" id="images">
<h2 class="title is-4">{% trans "Images" %}</h2>
<div class="box is-flex">
<div>
<label class="label" for="id_logo">{% trans "Logo:" %}</label>
{{ site_form.logo }}
<section class="block" id="display">
<h2 class="title is-4">{% trans "Display" %}</h2>
<div class="box">
<h3 class="title is-5">{% trans "Images" %}</h3>
<div class="block is-flex">
<div>
<label class="label" for="id_logo">{% trans "Logo:" %}</label>
{{ site_form.logo }}
</div>
<div>
<label class="label" for="id_logo_small">{% trans "Logo small:" %}</label>
{{ site_form.logo_small }}
</div>
<div>
<label class="label" for="id_favicon">{% trans "Favicon:" %}</label>
{{ site_form.favicon }}
</div>
</div>
<div>
<label class="label" for="id_logo_small">{% trans "Logo small:" %}</label>
{{ site_form.logo_small }}
</div>
<div>
<label class="label" for="id_favicon">{% trans "Favicon:" %}</label>
{{ site_form.favicon }}
<h3 class="title is-5">{% trans "Themes" %}</h3>
<div class="block">
<label class="label" for="id_default_theme">
{% trans "Default theme:" %}
</label>
<div class="select">
{{ site_form.default_theme }}
</div>
</div>
</div>
</section>

View File

@ -0,0 +1,122 @@
{% extends 'settings/layout.html' %}
{% load i18n %}
{% block title %}{% trans "Themes" %}{% endblock %}
{% block header %}{% trans "Themes" %}{% endblock %}
{% block breadcrumbs %}
<a class="subtitle help is-link" href="{% url 'settings-site' %}/#display">
{% trans "Set instance default theme" %}
</a>
{% endblock %}
{% 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">
<div class="notification content">
<h2 class="title is-5">{% trans "How to add a theme" %}</h2>
<ol>
<li>
{% trans "Copy the theme file into the <code>bookwyrm/static/css/themes</code> directory on your server from the command line." %}
</li>
<li>
{% trans "Run <code>./bw-dev collectstatic</code>." %}
</li>
<li>
{% trans "Add the file name using the form below to make it available in the application interface." %}
</li>
</ol>
</div>
</section>
<section class="block content">
<h2 class="title is-4">{% trans "Add theme" %}</h2>
{% 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"
>
<fieldset>
{% 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">
<label class="label" for="id_path">
{% trans "Theme filename" %}
</label>
<div class="control">
{{ theme_form.path }}
{% include 'snippets/form_errors.html' with errors_list=theme_form.path.errors id="desc_path" %}
</div>
</div>
</div>
<button type="submit" class="button">{% trans "Add theme" %}</button>
</fieldset>
</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>
<td><code>{{ theme.path }}</code></td>
<td>
<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>
</form>
</td>
</tr>
{% endfor %}
</table>
</div>
</section>
{% endblock %}

View File

@ -0,0 +1,16 @@
{% extends 'snippets/filters_panel/filter_field.html' %}
{% load i18n %}
{% block filter %}
<label class="label" for="id_email">{% trans "Email" %}</label>
<div class="control">
<input
type="text"
class="input"
name="email"
value="{{ request.GET.email|default:'' }}"
id="id_email" placeholder="user@email.com"
>
</div>
{% endblock %}

View File

@ -1,10 +1,23 @@
{% extends 'settings/layout.html' %}
{% load i18n %}
{% load utilities %}
{% block title %}{{ user.username }}{% endblock %}
{% block header %}
{{ user.username }}
<a class="help has-text-weight-normal" href="{% url 'settings-users' %}">{% trans "Back to users" %}</a>
{% endblock %}
{% block breadcrumbs %}
<nav class="breadcrumb subtitle" aria-label="breadcrumbs">
<ul>
<li><a href="{% url 'settings-users' %}">{% trans "Users" %}</a></li>
<li class="is-active">
<a href="#" aria-current="page">
{{ user|username }}
</a>
</li>
</ul>
</nav>
{% endblock %}
{% block panel %}

View File

@ -1,5 +1,7 @@
{% extends 'settings/layout.html' %}
{% load i18n %}
{% load utilities %}
{% block title %}{% trans "Users" %}{% endblock %}
{% block header %}
@ -15,46 +17,67 @@
{% include 'settings/users/user_admin_filters.html' %}
<table class="table is-striped">
<tr>
{% url 'settings-users' as url %}
<th>
{% trans "Username" as text %}
{% include 'snippets/table-sort-header.html' with field="username" sort=sort text=text %}
</th>
<th>
{% trans "Date Added" as text %}
{% include 'snippets/table-sort-header.html' with field="created_date" sort=sort text=text %}
</th>
<th>
{% trans "Last Active" as text %}
{% include 'snippets/table-sort-header.html' with field="last_active_date" sort=sort text=text %}
</th>
<th>
{% trans "Status" as text %}
{% include 'snippets/table-sort-header.html' with field="is_active" sort=sort text=text %}
</th>
<th>
{% trans "Remote instance" as text %}
{% include 'snippets/table-sort-header.html' with field="federated_server__server_name" sort=sort text=text %}
</th>
</tr>
{% for user in users %}
<tr>
<td><a href="{% url 'settings-user' user.id %}">{{ user.username }}</a></td>
<td>{{ user.created_date }}</td>
<td>{{ user.last_active_date }}</td>
<td>{% if user.is_active %}{% trans "Active" %}{% else %}{% trans "Inactive" %}{% endif %}</td>
<td>
{% if user.federated_server %}
<a href="{% url 'settings-federated-server' user.federated_server.id %}">{{ user.federated_server.server_name }}</a>
{% elif not user.local %}
<em>{% trans "Not set" %}</em>
<div class="block">
<div class="tabs">
<ul>
{% url 'settings-users' as url %}
<li {% if request.path in url %}class="is-active" aria-current="page"{% endif %}>
<a href="{{ url }}">{% trans "Local users" %}</a>
</li>
{% url 'settings-users' status="federated" as url %}
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
<a href="{{ url }}">{% trans "Federated community" %}</a>
</li>
</ul>
</div>
</div>
<div class="table-container block">
<table class="table is-striped">
<tr>
{% url 'settings-users' as url %}
<th>
{% trans "Username" as text %}
{% include 'snippets/table-sort-header.html' with field="username" sort=sort text=text %}
</th>
<th>
{% trans "Date Added" as text %}
{% include 'snippets/table-sort-header.html' with field="created_date" sort=sort text=text %}
</th>
<th>
{% trans "Last Active" as text %}
{% include 'snippets/table-sort-header.html' with field="last_active_date" sort=sort text=text %}
</th>
<th>
{% trans "Status" as text %}
{% include 'snippets/table-sort-header.html' with field="is_active" sort=sort text=text %}
</th>
{% if status != "local" %}
<th>
{% trans "Remote instance" as text %}
{% include 'snippets/table-sort-header.html' with field="federated_server__server_name" sort=sort text=text %}
</th>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</tr>
{% for user in users %}
<tr>
<td><a href="{% url 'settings-user' user.id %}">{{ user|username }}</a></td>
<td>{{ user.created_date }}</td>
<td>{{ user.last_active_date }}</td>
<td>{% if user.is_active %}{% trans "Active" %}{% else %}{% trans "Inactive" %}{% endif %}</td>
{% if status != "local" %}
<td>
{% if user.federated_server %}
<a href="{% url 'settings-federated-server' user.federated_server.id %}">{{ user.federated_server.server_name }}</a>
{% else %}
<em>{% trans "Not set" %}</em>
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% include 'snippets/pagination.html' with page=users path=request.path %}
{% endblock %}

View File

@ -2,6 +2,11 @@
{% block filter_fields %}
{% include 'settings/users/username_filter.html' %}
{% include 'directory/community_filter.html' %}
{% if status != "local" %}
{% include 'settings/users/server_filter.html' %}
{% else %}
{% include 'settings/users/email_filter.html' %}
{% endif %}
{% endblock %}

View File

@ -71,14 +71,14 @@
<dd>{{ user.last_active_date }}</dd>
<dt class="is-pulled-left mr-5">{% trans "Manually approved followers:" %}</dt>
<dd>{{ user.manually_approves_followers }}</dd>
<dd>{{ user.manually_approves_followers|yesno }}</dd>
<dt class="is-pulled-left mr-5">{% trans "Discoverable:" %}</dt>
<dd>{{ user.discoverable }}</dd>
<dd>{{ user.discoverable|yesno }}</dd>
{% if not user.is_active %}
<dt class="is-pulled-left mr-5">{% trans "Deactivation reason:" %}</dt>
<dd>{{ user.deactivation_reason }}</dd>
<dd>{{ user.get_deactivation_reason_display }}</dd>
{% endif %}
{% if not user.is_active and user.deactivation_reason == "pending" %}
@ -104,7 +104,7 @@
<dd>{{ server.application_version }}</dd>
<dt class="is-pulled-left mr-5">{% trans "Status:" %}</dt>
<dd>{{ server.status }}</dd>
<dd>{{ server.get_status_display }}</dd>
</dl>
{% if server.notes %}
<h5>{% trans "Notes" %}</h5>