Moves user admin templates into settings directory
This commit is contained in:
25
bookwyrm/templates/settings/users/delete_user_form.html
Normal file
25
bookwyrm/templates/settings/users/delete_user_form.html
Normal file
@ -0,0 +1,25 @@
|
||||
{% extends "components/inline_form.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block header %}
|
||||
{% trans "Permanently delete user" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block form %}
|
||||
<form name="delete-user" action="{% url 'settings-delete-user' user.id %}" method="post">
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
{% blocktrans trimmed with username=user.localname %}
|
||||
Are you sure you want to delete <strong>{{ username}}</strong>'s account? This action cannot be undone. To proceed, please enter your password to confirm deletion.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<div class="field">
|
||||
<label class="label" for="id_password">{% trans "Your password:" %}</label>
|
||||
<input class="input {% if form.password.errors %}is-danger{% endif %}" type="password" name="password" id="id_password" required>
|
||||
{% for error in form.password.errors %}
|
||||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<button type="submit" class="button is-danger">{% trans "Delete Account" %}</button>
|
||||
</form>
|
||||
{% endblock %}
|
7
bookwyrm/templates/settings/users/server_filter.html
Normal file
7
bookwyrm/templates/settings/users/server_filter.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% extends 'snippets/filters_panel/filter_field.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block filter %}
|
||||
<label class="label" for="id_server">{% trans "Instance name" %}</label>
|
||||
<input type="text" class="input" name="server" value="{{ request.GET.server|default:'' }}" id="id_server" placeholder="example.server.com">
|
||||
{% endblock %}
|
19
bookwyrm/templates/settings/users/user.html
Normal file
19
bookwyrm/templates/settings/users/user.html
Normal file
@ -0,0 +1,19 @@
|
||||
{% extends 'settings/layout.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{{ user.username }}{% endblock %}
|
||||
{% block header %}
|
||||
{{ user.username }}
|
||||
<p class="help has-text-weight-normal">
|
||||
<a href="{% url 'settings-users' %}">{% trans "Back to users" %}</a>
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
{% include 'settings/users/user_info.html' with user=user %}
|
||||
|
||||
{% include 'settings/users/user_moderation_actions.html' with user=user %}
|
||||
|
||||
{% endblock %}
|
||||
|
61
bookwyrm/templates/settings/users/user_admin.html
Normal file
61
bookwyrm/templates/settings/users/user_admin.html
Normal file
@ -0,0 +1,61 @@
|
||||
{% extends 'settings/layout.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Users" %}{% endblock %}
|
||||
|
||||
{% block header %}
|
||||
{% if server %}
|
||||
{% blocktrans with instance_name=server.server_name %}Users: <small>{{ instance_name }}</small>{% endblocktrans %}
|
||||
<a href="{% url 'settings-users' %}" class="help has-text-weight-normal">Clear filters</a>
|
||||
{% else %}
|
||||
{% trans "Users" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
|
||||
{% 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>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% include 'snippets/pagination.html' with page=users path=request.path %}
|
||||
{% endblock %}
|
||||
|
@ -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 %}
|
147
bookwyrm/templates/settings/users/user_info.html
Normal file
147
bookwyrm/templates/settings/users/user_info.html
Normal file
@ -0,0 +1,147 @@
|
||||
{% load i18n %}
|
||||
{% load markdown %}
|
||||
{% load humanize %}
|
||||
|
||||
<div class="block columns">
|
||||
<div class="column is-flex is-flex-direction-column">
|
||||
<h4 class="title is-4">{% trans "Profile" %}</h4>
|
||||
<div class="box is-flex-grow-1">
|
||||
{% include 'user/user_preview.html' with user=user %}
|
||||
{% if user.summary %}
|
||||
<div class="box content has-background-white-ter is-shadowless">
|
||||
{{ user.summary|to_markdown|safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<p class="mt-2"><a href="{{ user.local_path }}">{% trans "View user profile" %}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-flex is-flex-direction-column is-4">
|
||||
<h4 class="title is-4">{% trans "Status" %}</h4>
|
||||
<div class="box is-flex-grow-1 has-text-weight-bold">
|
||||
{% if user.is_active %}
|
||||
<p class="notification is-success">
|
||||
{% trans "Active" %}
|
||||
</p>
|
||||
{% else %}
|
||||
<p class="notification is-warning">
|
||||
{% trans "Inactive" %}
|
||||
{% if user.deactivation_reason %}
|
||||
<span class="help">({% trans user.get_deactivation_reason_display %})</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
<p class="notification">
|
||||
{% if user.local %}
|
||||
{% trans "Local" %}
|
||||
{% else %}
|
||||
{% trans "Remote" %}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="block columns">
|
||||
<div class="column is-flex is-flex-direction-column">
|
||||
<h4 class="title is-4">{% trans "User details" %}</h4>
|
||||
<div class="box content is-flex-grow-1">
|
||||
<dl>
|
||||
{% if user.local %}
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Email:" %}</dt>
|
||||
<dd>{{ user.email }}</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% with report_count=user.report_set.count %}
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Reports:" %}</dt>
|
||||
<dd>
|
||||
{{ report_count|intcomma }}
|
||||
{% if report_count > 0 %}
|
||||
<a href="{% url 'settings-reports' %}?username={{ user.username }}">
|
||||
{% trans "(View reports)" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</dd>
|
||||
</div>
|
||||
{% endwith %}
|
||||
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Blocked by count:" %}</dt>
|
||||
<dd>{{ user.blocked_by.count }}</dd>
|
||||
</div>
|
||||
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Last active date:" %}</dt>
|
||||
<dd>{{ user.last_active_date }}</dd>
|
||||
</div>
|
||||
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Manually approved followers:" %}</dt>
|
||||
<dd>{{ user.manually_approves_followers }}</dd>
|
||||
</div>
|
||||
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Discoverable:" %}</dt>
|
||||
<dd>{{ user.discoverable }}</dd>
|
||||
</div>
|
||||
|
||||
{% if not user.is_active %}
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Deactivation reason:" %}</dt>
|
||||
<dd>{{ user.deactivation_reason }}</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if not user.is_active and user.deactivation_reason == "pending" %}
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Confirmation code:" %}</dt>
|
||||
<dd>{{ user.confirmation_code }}</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if not user.local %}
|
||||
{% with server=user.federated_server %}
|
||||
<div class="column is-half is-flex is-flex-direction-column">
|
||||
<h4 class="title is-4">{% trans "Instance details" %}</h4>
|
||||
<div class="box content is-flex-grow-1">
|
||||
{% if server %}
|
||||
<h5>{{ server.server_name }}</h5>
|
||||
<dl>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Software:" %}</dt>
|
||||
<dd>{{ server.application_type }}</dd>
|
||||
</div>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Version:" %}</dt>
|
||||
<dd>{{ server.application_version }}</dd>
|
||||
</div>
|
||||
<div class="is-flex">
|
||||
<dt>{% trans "Status:" %}</dt>
|
||||
<dd>{{ server.status }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
{% if server.notes %}
|
||||
<h5>{% trans "Notes" %}</h5>
|
||||
<div class="box content has-background-white-ter is-shadowless">
|
||||
{{ server.notes }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
<a href="{% url 'settings-federated-server' server.id %}">{% trans "View instance" %}</a>
|
||||
</p>
|
||||
{% else %}
|
||||
<em>{% trans "Not set" %}</em>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -0,0 +1,70 @@
|
||||
{% load i18n %}
|
||||
<div class="block content">
|
||||
{% if not user.is_active and user.deactivation_reason == "self_deletion" or user.deactivation_reason == "moderator_deletion" %}
|
||||
<div class="notification is-danger">
|
||||
{% trans "Permanently deleted" %}
|
||||
</div>
|
||||
{% else %}
|
||||
<h3>{% trans "Actions" %}</h3>
|
||||
|
||||
<div class="is-flex">
|
||||
{% if user.is_active %}
|
||||
<p class="mr-1">
|
||||
<a class="button" href="{% url 'direct-messages-user' user.username %}">{% trans "Send direct message" %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if user.is_active or user.deactivation_reason == "pending" %}
|
||||
<form name="suspend" method="post" action="{% url 'settings-report-suspend' user.id %}" class="mr-1">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="button is-danger is-light">{% trans "Suspend user" %}</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form name="unsuspend" method="post" action="{% url 'settings-report-unsuspend' user.id %}" class="mr-1">
|
||||
{% csrf_token %}
|
||||
<button class="button">{% trans "Un-suspend user" %}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% if user.local %}
|
||||
<div>
|
||||
{% trans "Permanently delete user" as button_text %}
|
||||
{% include "snippets/toggle/open_button.html" with controls_text="delete_user" text=button_text class="is-danger is-light" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if user.local %}
|
||||
<div>
|
||||
{% include "settings/users/delete_user_form.html" with controls_text="delete_user" class="mt-2 mb-2" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if user.local %}
|
||||
<div>
|
||||
<form name="permission" method="post" action="{% url 'settings-user' user.id %}">
|
||||
{% csrf_token %}
|
||||
<label class="label" for="id_user_group">{% trans "Access level:" %}</label>
|
||||
{% if group_form.non_field_errors %}
|
||||
{{ group_form.non_field_errors }}
|
||||
{% endif %}
|
||||
{% with group=user.groups.first %}
|
||||
<div class="select">
|
||||
<select name="groups" id="id_user_group">
|
||||
{% for value, name in group_form.fields.groups.choices %}
|
||||
<option value="{{ value }}" {% if name == group.name %}selected{% endif %}>{{ name|title }}</option>
|
||||
{% endfor %}
|
||||
<option value="" {% if not group %}selected{% endif %}>User</option>
|
||||
</select>
|
||||
</div>
|
||||
{% for error in group_form.groups.errors %}
|
||||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
<button class="button">{% trans "Save" %}</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
8
bookwyrm/templates/settings/users/username_filter.html
Normal file
8
bookwyrm/templates/settings/users/username_filter.html
Normal file
@ -0,0 +1,8 @@
|
||||
{% extends 'snippets/filters_panel/filter_field.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block filter %}
|
||||
<label class="label" for="id_username">{% trans "Username" %}</label>
|
||||
<input type="text" class="input" name="username" value="{{ request.GET.username|default:'' }}" id="id_username" placeholder="user@domain.com">
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user