mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 11:31:08 +00:00
Admin UI for managing invite requests
This commit is contained in:
parent
d15396eb26
commit
f91a8144f4
5 changed files with 83 additions and 1 deletions
42
bookwyrm/templates/settings/manage_invite_requests.html
Normal file
42
bookwyrm/templates/settings/manage_invite_requests.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
{% extends 'settings/admin_layout.html' %}
|
||||
{% load i18n %}
|
||||
{% load humanize %}
|
||||
{% block header %}{% trans "Invite Requests" %}{% endblock %}
|
||||
{% block panel %}
|
||||
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
{% url 'settings-invites' as url %}
|
||||
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
|
||||
<a href="{{ url }}">{% trans "Invites" %}</a>
|
||||
</li>
|
||||
{% url 'settings-invite-requests' as url %}
|
||||
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
|
||||
<a href="{{ url }}">{% trans "Invite Requests" %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<section class="block">
|
||||
<h2 class="title is-4">{% trans "Invite Requests" %}</h2>
|
||||
|
||||
<table class="table is-striped">
|
||||
<tr>
|
||||
<th>{% trans "Date" %}</th>
|
||||
<th>{% trans "Email" %}</th>
|
||||
<th>{% trans "Status" %}</th>
|
||||
</tr>
|
||||
{% if not requests %}
|
||||
<tr><td colspan="4">{% trans "No requests" %}</td></tr>
|
||||
{% endif %}
|
||||
{% for req in requests %}
|
||||
<tr>
|
||||
<td>{{ req.created_date | naturaltime }}</td>
|
||||
<td>{{ req.email }}</td>
|
||||
<td>{% trans "Pending" %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% include 'snippets/pagination.html' with page=requests path=request.path %}
|
||||
</section>
|
||||
{% endblock %}
|
|
@ -3,6 +3,20 @@
|
|||
{% block header %}{% trans "Invites" %}{% endblock %}
|
||||
{% load humanize %}
|
||||
{% block panel %}
|
||||
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
{% url 'settings-invites' as url %}
|
||||
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
|
||||
<a href="{{ url }}">{% trans "Invites" %}</a>
|
||||
</li>
|
||||
{% url 'settings-invite-requests' as url %}
|
||||
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
|
||||
<a href="{{ url }}">{% trans "Invite Requests" %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<section class="block">
|
||||
<h2 class="title is-4">{% trans "Generate New Invite" %}</h2>
|
||||
|
||||
|
|
|
@ -54,6 +54,11 @@ urlpatterns = [
|
|||
re_path(
|
||||
r"^settings/invites/?$", views.ManageInvites.as_view(), name="settings-invites"
|
||||
),
|
||||
re_path(
|
||||
r"^settings/requests/?$",
|
||||
views.ManageInviteRequests.as_view(),
|
||||
name="settings-invite-requests",
|
||||
),
|
||||
re_path(
|
||||
r"^invite-request/?$", views.InviteRequest.as_view(), name="invite-request"
|
||||
),
|
||||
|
|
|
@ -13,7 +13,7 @@ from .goal import Goal, hide_goal
|
|||
from .import_data import Import, ImportStatus
|
||||
from .inbox import Inbox
|
||||
from .interaction import Favorite, Unfavorite, Boost, Unboost
|
||||
from .invite import ManageInvites, Invite, InviteRequest
|
||||
from .invite import ManageInvites, Invite, InviteRequest, ManageInviteRequests
|
||||
from .isbn import Isbn
|
||||
from .landing import About, Home, Discover
|
||||
from .list import Lists, List, Curate, UserLists
|
||||
|
|
|
@ -80,6 +80,27 @@ class Invite(View):
|
|||
# post handling is in views.authentication.Register
|
||||
|
||||
|
||||
class ManageInviteRequests(View):
|
||||
""" grant invites like the benevolent lord you are """
|
||||
|
||||
def get(self, request):
|
||||
""" view a list of requests """
|
||||
try:
|
||||
page = int(request.GET.get("page", 1))
|
||||
except ValueError:
|
||||
page = 1
|
||||
|
||||
paginated = Paginator(
|
||||
models.InviteRequest.objects.all().order_by("-created_date"),
|
||||
PAGE_LENGTH,
|
||||
)
|
||||
|
||||
data = {
|
||||
"requests": paginated.page(page),
|
||||
}
|
||||
return TemplateResponse(request, "settings/manage_invite_requests.html", data)
|
||||
|
||||
|
||||
class InviteRequest(View):
|
||||
""" prospective users sign up here """
|
||||
|
||||
|
|
Loading…
Reference in a new issue