2021-01-31 20:07:54 +00:00
|
|
|
{% extends 'lists/list_layout.html' %}
|
2021-01-31 18:34:25 +00:00
|
|
|
{% load bookwyrm_tags %}
|
2021-01-31 20:07:54 +00:00
|
|
|
{% block panel %}
|
2021-01-31 05:33:41 +00:00
|
|
|
|
2021-01-31 20:07:54 +00:00
|
|
|
{% if request.user == list.user and pending_count %}
|
2021-01-31 20:30:33 +00:00
|
|
|
<div class="block content">
|
2021-01-31 20:07:54 +00:00
|
|
|
<p>
|
|
|
|
<a href="{% url 'list-curate' list.id %}">{{ pending_count }} book{{ pending_count | pluralize }} awaiting your approval</a>
|
|
|
|
</p>
|
2021-01-31 19:45:16 +00:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
2021-01-31 18:34:25 +00:00
|
|
|
|
2021-01-31 20:30:33 +00:00
|
|
|
<div class="columns mt-3">
|
2021-01-31 18:34:25 +00:00
|
|
|
<section class="column is-three-quarters">
|
2021-01-31 19:21:50 +00:00
|
|
|
{% if not items.exists %}
|
2021-01-31 17:08:06 +00:00
|
|
|
<p>This list is currently empty</p>
|
|
|
|
{% else %}
|
2021-01-31 18:34:25 +00:00
|
|
|
<ol>
|
2021-01-31 19:21:50 +00:00
|
|
|
{% for item in items %}
|
2021-01-31 20:30:33 +00:00
|
|
|
<li class="block pb-3">
|
2021-01-31 18:34:25 +00:00
|
|
|
<div class="card">
|
2021-01-31 20:30:33 +00:00
|
|
|
<div class="card-content columns p-0 mb-0">
|
|
|
|
<div class="column is-narrow pt-0 pb-0">
|
2021-02-11 00:45:53 +00:00
|
|
|
<a href="{{ item.book.local_path }}">{% include 'snippets/book_cover.html' with book=item.book size="medium" %}</a>
|
2021-01-31 20:30:33 +00:00
|
|
|
</div>
|
|
|
|
<div class="column is-flex-direction-column is-align-items-self-start">
|
2021-01-31 18:34:25 +00:00
|
|
|
<span>{% include 'snippets/book_titleby.html' with book=item.book %}</span>
|
|
|
|
{% include 'snippets/stars.html' with rating=item.book|rating:request.user %}
|
2021-02-10 21:46:56 +00:00
|
|
|
{% include 'snippets/shelve_button/shelve_button.html' with book=item.book %}
|
2021-01-31 18:34:25 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="card-footer has-background-white-bis">
|
|
|
|
<div class="card-footer-item">
|
2021-02-04 22:27:26 +00:00
|
|
|
<p>Added by {% include 'snippets/username.html' with user=item.user %}</p>
|
2021-01-31 18:34:25 +00:00
|
|
|
</div>
|
2021-02-04 22:27:26 +00:00
|
|
|
{% if list.user == request.user or list.curation == 'open' and item.user == request.user %}
|
2021-01-31 20:15:38 +00:00
|
|
|
<form name="add-book" method="post" action="{% url 'list-remove-book' list.id %}" class="card-footer-item">
|
2021-01-31 18:34:25 +00:00
|
|
|
{% csrf_token %}
|
2021-01-31 20:15:38 +00:00
|
|
|
<input type="hidden" name="item" value="{{ item.id }}">
|
2021-01-31 18:34:25 +00:00
|
|
|
<button type="submit" class="button is-small is-danger">Remove</button>
|
|
|
|
</form>
|
2021-01-31 18:44:46 +00:00
|
|
|
{% endif %}
|
2021-01-31 18:34:25 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</li>
|
2021-01-31 17:08:06 +00:00
|
|
|
{% endfor %}
|
2021-01-31 18:34:25 +00:00
|
|
|
</ol>
|
2021-01-31 17:08:06 +00:00
|
|
|
{% endif %}
|
|
|
|
</section>
|
|
|
|
|
2021-01-31 21:38:26 +00:00
|
|
|
{% if request.user.is_authenticated and not list.curation == 'closed' or request.user == list.user %}
|
2021-01-31 20:31:39 +00:00
|
|
|
<section class="column is-one-quarter content">
|
2021-01-31 18:56:40 +00:00
|
|
|
<h2>{% if list.curation == 'open' or request.user == list.user %}Add{% else %}Suggest{% endif %} Books</h2>
|
2021-01-31 19:11:26 +00:00
|
|
|
<form name="search" action="{% url 'list' list.id %}" method="GET" class="block">
|
|
|
|
<div class="field has-addons">
|
|
|
|
<div class="control">
|
|
|
|
<input aria-label="Search for a book" class="input" type="text" name="q" placeholder="Search for a book" value="{{ query }}">
|
|
|
|
</div>
|
|
|
|
<div class="control">
|
|
|
|
<button class="button" type="submit">
|
|
|
|
<span class="icon icon-search" title="Search">
|
|
|
|
<span class="is-sr-only">search</span>
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% if query %}
|
|
|
|
<p class="help"><a href="{% url 'list' list.id %}">Clear search</a></p>
|
|
|
|
{% endif %}
|
|
|
|
</form>
|
2021-01-31 19:13:05 +00:00
|
|
|
{% if not suggested_books %}
|
|
|
|
<p>No books found{% if query %} matching the query "{{ query }}"{% endif %}</p>
|
|
|
|
{% endif %}
|
2021-01-31 17:08:06 +00:00
|
|
|
{% for book in suggested_books %}
|
2021-02-10 21:46:56 +00:00
|
|
|
{% if book %}
|
2021-01-31 17:08:06 +00:00
|
|
|
<div class="block columns">
|
|
|
|
<div class="column is-narrow">
|
|
|
|
<a href="{{ book.local_path }}">{% include 'snippets/book_cover.html' with book=book size="small" %}</a>
|
|
|
|
</div>
|
|
|
|
<div class="column">
|
|
|
|
<p>{% include 'snippets/book_titleby.html' with book=book %}</p>
|
|
|
|
<form name="add-book" method="post" action="{% url 'list-add-book' list.id %}">
|
|
|
|
{% csrf_token %}
|
2021-01-31 18:34:25 +00:00
|
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
2021-01-31 19:13:50 +00:00
|
|
|
<button type="submit" class="button is-small is-link">{% if list.curation == 'open' or request.user == list.user %}Add{% else %}Suggest{% endif %}</button>
|
2021-01-31 17:08:06 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-02-10 21:46:56 +00:00
|
|
|
{% endif %}
|
2021-01-31 17:08:06 +00:00
|
|
|
{% endfor %}
|
|
|
|
</section>
|
2021-01-31 18:34:25 +00:00
|
|
|
{% endif %}
|
2021-01-31 17:08:06 +00:00
|
|
|
</div>
|
2021-01-31 05:33:41 +00:00
|
|
|
{% endblock %}
|