Adds blocked users view
also refactors the setting view
This commit is contained in:
21
bookwyrm/templates/blocks.html
Normal file
21
bookwyrm/templates/blocks.html
Normal file
@ -0,0 +1,21 @@
|
||||
{% extends 'preferences_layout.html' %}
|
||||
|
||||
{% block header %}
|
||||
Blocked Users
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
<ul>
|
||||
{% for user in request.user.blocks.all %}
|
||||
<li class="is-flex">
|
||||
<p>
|
||||
{% include 'snippets/avatar.html' with user=user %} {% include 'snippets/username.html' with user=user %}
|
||||
</p>
|
||||
<p class="mr-2">
|
||||
{% include 'snippets/block_button.html' with user=user %}
|
||||
</p>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
19
bookwyrm/templates/change_password.html
Normal file
19
bookwyrm/templates/change_password.html
Normal file
@ -0,0 +1,19 @@
|
||||
{% extends 'preferences_layout.html' %}
|
||||
{% block header %}
|
||||
Change Password
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
<form name="edit-profile" action="/change-password/" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<div class="block">
|
||||
<label class="label" for="id_password">New password:</label>
|
||||
<input type="password" name="password" maxlength="128" class="input" required="" id="id_password">
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="label" for="id_confirm_password">Confirm password:</label>
|
||||
<input type="password" name="confirm-password" maxlength="128" class="input" required="" id="id_confirm_password">
|
||||
</div>
|
||||
<button class="button is-primary" type="submit">Change password</button>
|
||||
</form>
|
||||
{% endblock %}
|
@ -1,66 +1,48 @@
|
||||
{% extends 'layout.html' %}
|
||||
{% block content %}
|
||||
<div class="block columns">
|
||||
<div class="column is-half">
|
||||
<h1 class="title">Profile</h1>
|
||||
{% if form.non_field_errors %}
|
||||
<p class="notification is-danger">{{ form.non_field_errors }}</p>
|
||||
{% endif %}
|
||||
<form name="edit-profile" action="/edit-profile/" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<div class="block">
|
||||
<label class="label" for="id_avatar">Avatar:</label>
|
||||
{{ form.avatar }}
|
||||
{% for error in form.avatar.errors %}
|
||||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="label" for="id_name">Display name:</label>
|
||||
{{ form.name }}
|
||||
{% for error in form.name.errors %}
|
||||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="label" for="id_summary">Summary:</label>
|
||||
{{ form.summary }}
|
||||
{% for error in form.summary.errors %}
|
||||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="label" for="id_email">Email address:</label>
|
||||
{{ form.email }}
|
||||
{% for error in form.email.errors %}
|
||||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="checkbox label" for="id_manually_approves_followers">
|
||||
Manually approve followers:
|
||||
{{ form.manually_approves_followers }}
|
||||
</label>
|
||||
</div>
|
||||
<button class="button is-primary" type="submit">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="column is-half">
|
||||
<div class="block">
|
||||
<h2 class="title">Change password</h2>
|
||||
<form name="edit-profile" action="/change-password/" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<div class="block">
|
||||
<label class="label" for="id_password">New password:</label>
|
||||
<input type="password" name="password" maxlength="128" class="input" required="" id="id_password">
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="label" for="id_confirm_password">Confirm password:</label>
|
||||
<input type="password" name="confirm-password" maxlength="128" class="input" required="" id="id_confirm_password">
|
||||
</div>
|
||||
<button class="button is-primary" type="submit">Change password</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% extends 'preferences_layout.html' %}
|
||||
{% block header %}
|
||||
Edit Profile
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
{% if form.non_field_errors %}
|
||||
<p class="notification is-danger">{{ form.non_field_errors }}</p>
|
||||
{% endif %}
|
||||
<form name="edit-profile" action="/edit-profile/" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<div class="block">
|
||||
<label class="label" for="id_avatar">Avatar:</label>
|
||||
{{ form.avatar }}
|
||||
{% for error in form.avatar.errors %}
|
||||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="label" for="id_name">Display name:</label>
|
||||
{{ form.name }}
|
||||
{% for error in form.name.errors %}
|
||||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="label" for="id_summary">Summary:</label>
|
||||
{{ form.summary }}
|
||||
{% for error in form.summary.errors %}
|
||||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="label" for="id_email">Email address:</label>
|
||||
{{ form.email }}
|
||||
{% for error in form.email.errors %}
|
||||
<p class="help is-danger">{{ error | escape }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="block">
|
||||
<label class="checkbox label" for="id_manually_approves_followers">
|
||||
Manually approve followers:
|
||||
{{ form.manually_approves_followers }}
|
||||
</label>
|
||||
</div>
|
||||
<button class="button is-primary" type="submit">Save</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
31
bookwyrm/templates/preferences_layout.html
Normal file
31
bookwyrm/templates/preferences_layout.html
Normal file
@ -0,0 +1,31 @@
|
||||
{% extends 'layout.html' %}
|
||||
{% block content %}
|
||||
|
||||
<header class="block column is-offset-one-quarter pl-1">
|
||||
<h1 class="title">{% block header %}{% endblock %}</h1>
|
||||
</header>
|
||||
|
||||
<div class="block columns">
|
||||
<nav class="menu column is-one-quarter">
|
||||
<h2 class="menu-label">Account</h2>
|
||||
<ul class="menu-list">
|
||||
<li>
|
||||
<a href="/edit-profile"{% if '/edit-profile' in request.path %} class="is-active" aria-selected="true"{% endif %}>Profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/change-password"{% if '/change-password' in request.path %} class="is-active" aria-selected="true"{% endif %}>Change password</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h2 class="menu-label">Relationships</h2>
|
||||
<ul class="menu-list">
|
||||
<li>
|
||||
<a href="/block"{% if '/block' in request.path %} class="is-active" aria-selected="true"{% endif %}>Blocked users</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="column content">
|
||||
{% block panel %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@ -1,11 +1,11 @@
|
||||
{% if not user in request.user.blocks.all %}
|
||||
<form name="blocks" method="post" action="/block/{{ user.id }}">
|
||||
{% csrf_token %}
|
||||
<button class="button is-danger is-light is-small is-fullwidth" type="submit">Block</button>
|
||||
<button class="button is-danger is-light is-small {{ class }}" type="submit">Block</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form name="unblocks" method="post" action="/unblock/{{ user.id }}">
|
||||
{% csrf_token %}
|
||||
<button class="button is-small is-fullwidth" type="submit">Un-block</button>
|
||||
<button class="button is-small {{ class }}" type="submit">Un-block</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user