Merge branch 'main' into mobile/dropdown-larger-size
This commit is contained in:
commit
ed040cd3e4
10 changed files with 62 additions and 24 deletions
|
@ -215,10 +215,10 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% with work=book.parent_work %}
|
{% with work=book.parent_work editions_count=book.parent_work.editions.count %}
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ work.local_path }}/editions" id="tour-other-editions-link">
|
<a href="{{ work.local_path }}/editions" id="tour-other-editions-link">
|
||||||
{% blocktrans trimmed count counter=work.editions.count with count=work.editions.count|intcomma %}
|
{% blocktrans trimmed count counter=editions_count with count=editions_count|intcomma %}
|
||||||
{{ count }} edition
|
{{ count }} edition
|
||||||
{% plural %}
|
{% plural %}
|
||||||
{{ count }} editions
|
{{ count }} editions
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<nav class="navbar" aria-label="main navigation">
|
<nav class="navbar" aria-label="main navigation">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
{% with notification_count=request.user.unread_notification_count has_unread_mentions=request.user.has_unread_mentions %}
|
||||||
<div class="navbar-brand">
|
<div class="navbar-brand">
|
||||||
<a class="navbar-item" href="/">
|
<a class="navbar-item" href="/">
|
||||||
<img class="image logo" src="{% if site.logo_small %}{% get_media_prefix %}{{ site.logo_small }}{% else %}{% static "images/logo-small.png" %}{% endif %}" alt="{% blocktrans with site_name=site.name %}{{ site_name }} home page{% endblocktrans %}">
|
<img class="image logo" src="{% if site.logo_small %}{% get_media_prefix %}{{ site.logo_small }}{% else %}{% static "images/logo-small.png" %}{% endif %}" alt="{% blocktrans with site_name=site.name %}{{ site_name }} home page{% endblocktrans %}">
|
||||||
|
@ -67,9 +68,8 @@
|
||||||
>
|
>
|
||||||
<i class="icon-dots-three-vertical" aria-hidden="true"></i>
|
<i class="icon-dots-three-vertical" aria-hidden="true"></i>
|
||||||
|
|
||||||
{% with request.user.unread_notification_count as notification_count %}
|
|
||||||
<strong
|
<strong
|
||||||
class="{% if not notification_count %}is-hidden {% elif request.user.has_unread_mentions %}is-danger {% else %}is-primary {% endif %} tag is-small px-1"
|
class="{% if not notification_count %}is-hidden {% elif has_unread_mentions %}is-danger {% else %}is-primary {% endif %} tag is-small px-1"
|
||||||
data-poll-wrapper
|
data-poll-wrapper
|
||||||
>
|
>
|
||||||
<span class="is-sr-only">{% trans "Notifications" %}</span>
|
<span class="is-sr-only">{% trans "Notifications" %}</span>
|
||||||
|
@ -77,7 +77,6 @@
|
||||||
{{ notification_count }}
|
{{ notification_count }}
|
||||||
</strong>
|
</strong>
|
||||||
</strong>
|
</strong>
|
||||||
{% endwith %}
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -108,14 +107,12 @@
|
||||||
<span class="is-sr-only">{% trans "Notifications" %}</span>
|
<span class="is-sr-only">{% trans "Notifications" %}</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
{% with request.user.unread_notification_count as notification_count %}
|
|
||||||
<span
|
<span
|
||||||
class="{% if not notification_count %}is-hidden {% elif request.user.has_unread_mentions %}is-danger {% endif %}tag is-medium transition-x"
|
class="{% if not notification_count %}is-hidden {% elif has_unread_mentions %}is-danger {% endif %}tag is-medium transition-x"
|
||||||
data-poll-wrapper
|
data-poll-wrapper
|
||||||
>
|
>
|
||||||
<span data-poll="notifications">{{ notification_count }}</span>
|
<span data-poll="notifications">{{ notification_count }}</span>
|
||||||
</span>
|
</span>
|
||||||
{% endwith %}
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -154,6 +151,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,12 @@
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if not user.is_active and user.deactivation_reason == "pending" %}
|
||||||
|
<form name="activate" method="post" action="{% url 'settings-activate-user' user.id %}" class="mr-1">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="submit" class="button is-success is-light">{% trans "Activate user" %}</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
{% if user.is_active or user.deactivation_reason == "pending" %}
|
{% if user.is_active or user.deactivation_reason == "pending" %}
|
||||||
<form name="suspend" method="post" action="{% url 'settings-report-suspend' user.id %}" class="mr-1">
|
<form name="suspend" method="post" action="{% url 'settings-report-suspend' user.id %}" class="mr-1">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
|
@ -19,9 +19,9 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
|
||||||
{# Supplemental fields #}
|
{# Supplemental fields #}
|
||||||
<div>
|
<div>
|
||||||
{% active_shelf book as active_shelf %}
|
{% active_shelf book as active_shelf %}
|
||||||
{% if active_shelf.shelf.identifier == 'reading' and book.latest_readthrough %}
|
{% if active_shelf.shelf.identifier == 'reading' %}
|
||||||
|
|
||||||
{% with readthrough=book.latest_readthrough %}
|
{% with readthrough=book.latest_readthrough %}
|
||||||
|
{% if readthrough %}
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<input type="hidden" name="id" value="{{ readthrough.id }}"/>
|
<input type="hidden" name="id" value="{{ readthrough.id }}"/>
|
||||||
<label class="label" for="progress_{{ uuid }}">{% trans "Progress:" %}</label>
|
<label class="label" for="progress_{{ uuid }}">{% trans "Progress:" %}</label>
|
||||||
|
@ -66,6 +66,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
|
||||||
<p class="help">{% blocktrans with pages=book.pages %}of {{ pages }} pages{% endblocktrans %}</p>
|
<p class="help">{% blocktrans with pages=book.pages %}of {{ pages }} pages{% endblocktrans %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
{# Three day cache #}
|
{# Three day cache #}
|
||||||
{% get_current_language as LANGUAGE_CODE %}
|
{% get_current_language as LANGUAGE_CODE %}
|
||||||
{% cache 259200 generated_note_header LANGUAGE_CODE status.id %}
|
{% cache 259200 generated_note_header LANGUAGE_CODE status.id %}
|
||||||
{% if status.content == 'wants to read' %}
|
{% if status.content == 'wants to read' or status.content == '<p>wants to read</p>' %}
|
||||||
{% include 'snippets/status/headers/to_read.html' with book=status.mention_books.first %}
|
{% include 'snippets/status/headers/to_read.html' with book=status.mention_books.first %}
|
||||||
{% elif status.content == 'finished reading' %}
|
{% elif status.content == 'finished reading' or status.content == '<p>finished reading</p>' %}
|
||||||
{% include 'snippets/status/headers/read.html' with book=status.mention_books.first %}
|
{% include 'snippets/status/headers/read.html' with book=status.mention_books.first %}
|
||||||
{% elif status.content == 'started reading' %}
|
{% elif status.content == 'started reading' or status.content == '<p>started reading</p>' %}
|
||||||
{% include 'snippets/status/headers/reading.html' with book=status.mention_books.first %}
|
{% include 'snippets/status/headers/reading.html' with book=status.mention_books.first %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ status.content }}
|
{{ status.content }}
|
||||||
|
|
|
@ -145,6 +145,11 @@ urlpatterns = [
|
||||||
views.UserAdmin.as_view(),
|
views.UserAdmin.as_view(),
|
||||||
name="settings-user",
|
name="settings-user",
|
||||||
),
|
),
|
||||||
|
re_path(
|
||||||
|
r"^settings/users/(?P<user>\d+)/activate/?$",
|
||||||
|
views.ActivateUserAdmin.as_view(),
|
||||||
|
name="settings-activate-user",
|
||||||
|
),
|
||||||
re_path(
|
re_path(
|
||||||
r"^settings/federation/(?P<status>(federated|blocked))?/?$",
|
r"^settings/federation/(?P<status>(federated|blocked))?/?$",
|
||||||
views.Federation.as_view(),
|
views.Federation.as_view(),
|
||||||
|
|
|
@ -31,7 +31,7 @@ from .admin.reports import (
|
||||||
)
|
)
|
||||||
from .admin.site import Site, Registration, RegistrationLimited
|
from .admin.site import Site, Registration, RegistrationLimited
|
||||||
from .admin.themes import Themes, delete_theme
|
from .admin.themes import Themes, delete_theme
|
||||||
from .admin.user_admin import UserAdmin, UserAdminList
|
from .admin.user_admin import UserAdmin, UserAdminList, ActivateUserAdmin
|
||||||
|
|
||||||
# user preferences
|
# user preferences
|
||||||
from .preferences.change_password import ChangePassword
|
from .preferences.change_password import ChangePassword
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
""" manage user """
|
""" manage user """
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
@ -95,3 +95,19 @@ class UserAdmin(View):
|
||||||
form.save(request)
|
form.save(request)
|
||||||
data = {"user": user, "group_form": form}
|
data = {"user": user, "group_form": form}
|
||||||
return TemplateResponse(request, "settings/users/user.html", data)
|
return TemplateResponse(request, "settings/users/user.html", data)
|
||||||
|
|
||||||
|
|
||||||
|
@method_decorator(login_required, name="dispatch")
|
||||||
|
@method_decorator(
|
||||||
|
permission_required("bookwyrm.moderate_user", raise_exception=True),
|
||||||
|
name="dispatch",
|
||||||
|
)
|
||||||
|
class ActivateUserAdmin(View):
|
||||||
|
"""activate a user manually"""
|
||||||
|
|
||||||
|
# pylint: disable=unused-argument
|
||||||
|
def post(self, request, user):
|
||||||
|
"""activate user"""
|
||||||
|
user = get_object_or_404(models.User, id=user)
|
||||||
|
user.reactivate()
|
||||||
|
return redirect("settings-user", user.id)
|
||||||
|
|
|
@ -237,16 +237,24 @@ def feed_page_data(user):
|
||||||
def get_suggested_books(user, max_books=5):
|
def get_suggested_books(user, max_books=5):
|
||||||
"""helper to get a user's recent books"""
|
"""helper to get a user's recent books"""
|
||||||
book_count = 0
|
book_count = 0
|
||||||
preset_shelves = [("reading", max_books), ("read", 2), ("to-read", max_books)]
|
preset_shelves = {"reading": max_books, "read": 2, "to-read": max_books}
|
||||||
suggested_books = []
|
suggested_books = []
|
||||||
for (preset, shelf_max) in preset_shelves:
|
|
||||||
|
user_shelves = {
|
||||||
|
shelf.identifier: shelf
|
||||||
|
for shelf in user.shelf_set.filter(
|
||||||
|
identifier__in=preset_shelves.keys()
|
||||||
|
).exclude(books__isnull=True)
|
||||||
|
}
|
||||||
|
|
||||||
|
for preset, shelf_max in preset_shelves.items():
|
||||||
limit = (
|
limit = (
|
||||||
shelf_max
|
shelf_max
|
||||||
if shelf_max < (max_books - book_count)
|
if shelf_max < (max_books - book_count)
|
||||||
else max_books - book_count
|
else max_books - book_count
|
||||||
)
|
)
|
||||||
shelf = user.shelf_set.get(identifier=preset)
|
shelf = user_shelves.get(preset, None)
|
||||||
if not shelf.books.exists():
|
if not shelf:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
shelf_preview = {
|
shelf_preview = {
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: 0.0.1\n"
|
"Project-Id-Version: 0.0.1\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2023-01-26 16:43+0000\n"
|
"POT-Creation-Date: 2023-01-30 08:21+0000\n"
|
||||||
"PO-Revision-Date: 2021-02-28 17:19-0800\n"
|
"PO-Revision-Date: 2021-02-28 17:19-0800\n"
|
||||||
"Last-Translator: Mouse Reeve <mousereeve@riseup.net>\n"
|
"Last-Translator: Mouse Reeve <mousereeve@riseup.net>\n"
|
||||||
"Language-Team: English <LL@li.org>\n"
|
"Language-Team: English <LL@li.org>\n"
|
||||||
|
@ -851,7 +851,7 @@ msgstr ""
|
||||||
#: bookwyrm/templates/settings/registration.html:96
|
#: bookwyrm/templates/settings/registration.html:96
|
||||||
#: bookwyrm/templates/settings/registration_limited.html:76
|
#: bookwyrm/templates/settings/registration_limited.html:76
|
||||||
#: bookwyrm/templates/settings/site.html:144
|
#: bookwyrm/templates/settings/site.html:144
|
||||||
#: bookwyrm/templates/settings/users/user_moderation_actions.html:69
|
#: bookwyrm/templates/settings/users/user_moderation_actions.html:75
|
||||||
#: bookwyrm/templates/shelf/form.html:25
|
#: bookwyrm/templates/shelf/form.html:25
|
||||||
#: bookwyrm/templates/snippets/reading_modals/layout.html:18
|
#: bookwyrm/templates/snippets/reading_modals/layout.html:18
|
||||||
msgid "Save"
|
msgid "Save"
|
||||||
|
@ -5448,7 +5448,7 @@ msgid "Remove theme"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/templates/settings/users/delete_user_form.html:5
|
#: bookwyrm/templates/settings/users/delete_user_form.html:5
|
||||||
#: bookwyrm/templates/settings/users/user_moderation_actions.html:32
|
#: bookwyrm/templates/settings/users/user_moderation_actions.html:38
|
||||||
msgid "Permanently delete user"
|
msgid "Permanently delete user"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -5570,14 +5570,18 @@ msgid "User Actions"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/templates/settings/users/user_moderation_actions.html:21
|
#: bookwyrm/templates/settings/users/user_moderation_actions.html:21
|
||||||
|
msgid "Activate user"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/settings/users/user_moderation_actions.html:27
|
||||||
msgid "Suspend user"
|
msgid "Suspend user"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/templates/settings/users/user_moderation_actions.html:26
|
#: bookwyrm/templates/settings/users/user_moderation_actions.html:32
|
||||||
msgid "Un-suspend user"
|
msgid "Un-suspend user"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: bookwyrm/templates/settings/users/user_moderation_actions.html:48
|
#: bookwyrm/templates/settings/users/user_moderation_actions.html:54
|
||||||
msgid "Access level:"
|
msgid "Access level:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue