moviewyrm/bookwyrm/templates/settings/manage_invites.html
2021-09-08 14:06:43 -07:00

66 lines
2.2 KiB
HTML

{% extends 'settings/layout.html' %}
{% load i18n %}
{% block header %}{% trans "Invites" %}{% endblock %}
{% load humanize %}
{% block panel %}
<div class="tabs">
<ul>
{% 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>
{% 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>
</ul>
</div>
<section class="block">
<h2 class="title is-4">{% trans "Generate New Invite" %}</h2>
<form name="invite" action="{% url 'settings-invites' %}" method="post">
{% csrf_token %}
<div class="field is-grouped">
<div class="control">
<label class="label" for="id_expiry">{% trans "Expiry:" %}</label>
<div class="select">
{{ form.expiry }}
</div>
</div>
<div class="control">
<label class="label" for="id_use_limit">{% trans "Use limit:" %}</label>
<div class="select">
{{ form.use_limit }}
</div>
</div>
</div>
<button class="button is-primary" type="submit">{% trans "Create Invite" %}</button>
</form>
</section>
<section class="block">
<table class="table is-striped">
<tr>
<th>{% trans "Link" %}</th>
<th>{% trans "Expires" %}</th>
<th>{% trans "Max uses" %}</th>
<th>{% trans "Times used" %}</th>
</tr>
{% if not invites %}
<tr><td colspan="4">{% trans "No active invites" %}</td></tr>
{% endif %}
{% for invite in invites %}
<tr>
<td><a href="{{ invite.link }}">{{ invite.link }}</a></td>
<td>{{ invite.expiry|naturaltime }}</td>
<td>{{ invite.use_limit }}</td>
<td>{{ invite.times_used }}</td>
</tr>
{% endfor %}
</table>
{% include 'snippets/pagination.html' with page=invites path=request.path %}
</section>
{% endblock %}