forked from mirrors/bookwyrm
Invites page
This commit is contained in:
parent
8260dcf804
commit
1d5d7f8965
6 changed files with 62 additions and 26 deletions
|
@ -1,17 +1,22 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="content-container">
|
<div class="block">
|
||||||
<h2>Import Books from GoodReads</h2>
|
<h2 class="title">Import Books from GoodReads</h2>
|
||||||
<form name="import" action="/import_data/" method="post" enctype="multipart/form-data">
|
<form name="import" action="/import_data/" method="post" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ import_form.as_p }}
|
{{ import_form.as_p }}
|
||||||
<button type="submit">Import</button>
|
<button class="button" type="submit">Import</button>
|
||||||
</form>
|
</form>
|
||||||
<p>
|
<p>
|
||||||
Imports are limited in size, and only the first {{ limit }} items will be imported.
|
Imports are limited in size, and only the first {{ limit }} items will be imported.
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2>Recent Imports</h2>
|
<div class="content block">
|
||||||
|
<h2 class="title">Recent Imports</h2>
|
||||||
|
{% if not jobs %}
|
||||||
|
<p>No recent imports</p>
|
||||||
|
{% endif %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for job in jobs %}
|
{% for job in jobs %}
|
||||||
<li><a href="/import_status/{{ job.id }}">{{ job.created_date | naturaltime }}</a></li>
|
<li><a href="/import_status/{{ job.id }}">{{ job.created_date | naturaltime }}</a></li>
|
||||||
|
|
|
@ -67,7 +67,13 @@
|
||||||
<a href="/user/{{request.user.localname}}" class="navbar-item">
|
<a href="/user/{{request.user.localname}}" class="navbar-item">
|
||||||
Profile
|
Profile
|
||||||
</a>
|
</a>
|
||||||
<a class="navbar-item">
|
<a href="/user-edit" class="navbar-item">
|
||||||
|
Settings
|
||||||
|
</a>
|
||||||
|
<a href="/invite" class="navbar-item">
|
||||||
|
Invites
|
||||||
|
</a>
|
||||||
|
<a href="/import" class="navbar-item">
|
||||||
Import books
|
Import books
|
||||||
</a>
|
</a>
|
||||||
<hr class="navbar-divider">
|
<hr class="navbar-divider">
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="content-container">
|
<div class="block">
|
||||||
<div class="manage-invites">
|
<h2 class="title">Invites</h2>
|
||||||
<h2>Invites</h2>
|
<table class="table is-striped">
|
||||||
<table>
|
<tr>
|
||||||
<tr>
|
<th>Link</th>
|
||||||
<th>Link</th>
|
<th>Expires</th>
|
||||||
<th>Expires</th>
|
<th>Max uses</th>
|
||||||
<th>Max uses</th>
|
<th>Times used</th>
|
||||||
<th>Times used</th>
|
</tr>
|
||||||
</tr>
|
{% if not invites %}
|
||||||
|
<tr><td colspan="4">No active invites</td></tr>
|
||||||
|
{% endif %}
|
||||||
{% for invite in invites %}
|
{% for invite in invites %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ invite.link }}">{{ invite.link }}</td>
|
<td><a href="{{ invite.link }}">{{ invite.link }}</td>
|
||||||
|
@ -19,14 +21,33 @@
|
||||||
<td>{{ invite.times_used }}</td>
|
<td>{{ invite.times_used }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
<h2>Generate New Invite</h2>
|
</div>
|
||||||
|
|
||||||
<form name="avatar" action="/create_invite/" method="post">
|
<div class="block">
|
||||||
{% csrf_token %}
|
<h2 class="title is-4">Generate New Invite</h2>
|
||||||
{{ form.as_p }}
|
|
||||||
<button type="submit">Create Invite</button>
|
<form name="invite" action="/create_invite/" method="post">
|
||||||
</form>
|
{% csrf_token %}
|
||||||
</div>
|
<div class="field">
|
||||||
|
<div class="control">
|
||||||
|
<label class="label" for="id_expiry">Expiry:</label>
|
||||||
|
</div>
|
||||||
|
<div class="select">
|
||||||
|
{{ form.expiry }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<div class="control">
|
||||||
|
<label class="label" for="id_use_limit">Use limit:</label>
|
||||||
|
</div>
|
||||||
|
<div class="select">
|
||||||
|
{{ form.use_limit }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="button is-primary" type="submit">Create Invite</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -14,7 +14,11 @@
|
||||||
{% if shelf.size > 3 %}<small>(<a href="{{ shelf.remote_id }}">See all {{ shelf.size }}</a>)</small>{% endif %}</h3>
|
{% if shelf.size > 3 %}<small>(<a href="{{ shelf.remote_id }}">See all {{ shelf.size }}</a>)</small>{% endif %}</h3>
|
||||||
<div class="is-mobile field is-grouped">
|
<div class="is-mobile field is-grouped">
|
||||||
{% for book in shelf.books %}
|
{% for book in shelf.books %}
|
||||||
{% include 'snippets/book_cover.html' with book=book size="medium" %}
|
<div class="control">
|
||||||
|
<a href="/book/{{ book.id }}">
|
||||||
|
{% include 'snippets/book_cover.html' with book=book size="medium" %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -40,8 +40,8 @@ urlpatterns = [
|
||||||
re_path(r'^login/?$', views.login_page),
|
re_path(r'^login/?$', views.login_page),
|
||||||
re_path(r'^register/?$', views.register_page),
|
re_path(r'^register/?$', views.register_page),
|
||||||
re_path(r'^about/?$', views.about_page),
|
re_path(r'^about/?$', views.about_page),
|
||||||
|
re_path(r'^invite/?$', views.manage_invites),
|
||||||
re_path(r'^invite/(?P<code>[A-Za-z0-9]+)/?$', views.invite_page),
|
re_path(r'^invite/(?P<code>[A-Za-z0-9]+)/?$', views.invite_page),
|
||||||
re_path(r'^manage_invites/?$', views.manage_invites),
|
|
||||||
|
|
||||||
path('', views.home),
|
path('', views.home),
|
||||||
re_path(r'^(?P<tab>home|local|federated)/?$', views.home_tab),
|
re_path(r'^(?P<tab>home|local|federated)/?$', views.home_tab),
|
||||||
|
|
|
@ -444,4 +444,4 @@ def create_invite(request):
|
||||||
invite.user = request.user
|
invite.user = request.user
|
||||||
invite.save()
|
invite.save()
|
||||||
|
|
||||||
return redirect('/manage_invites')
|
return redirect('/invite')
|
||||||
|
|
Loading…
Reference in a new issue