2021-01-31 05:33:41 +00:00
{% extends 'layout.html' %}
2021-01-31 18:34:25 +00:00
{% load bookwyrm_tags %}
2021-01-31 05:33:41 +00:00
{% block content %}
2021-01-31 17:08:06 +00:00
< header class = "columns content" >
< div class = "column" >
< h1 class = "title" > {{ list.name }} < span class = "subtitle" > {% include 'snippets/privacy-icons.html' with item=list %}< / span > < / h1 >
2021-01-31 18:56:40 +00:00
< p class = "subtitle help" > Created {% if list.curation != 'open' %} and curated{% endif %} by {% include 'snippets/username.html' with user=list.user %}< / p >
2021-01-31 17:08:06 +00:00
{% include 'snippets/trimmed_text.html' with full=list.description %}
< / div >
2021-01-31 18:34:25 +00:00
{% if request.user == list.user %}
2021-01-31 17:08:06 +00:00
< div class = "column is-narrow" >
2021-01-31 18:34:25 +00:00
{% include 'snippets/toggle/open_button.html' with text="Edit list" icon="pencil" controls_text="create-list" %}
2021-01-31 17:08:06 +00:00
< / div >
2021-01-31 18:34:25 +00:00
{% endif %}
2021-01-31 17:08:06 +00:00
< / header >
2021-01-31 05:33:41 +00:00
2021-01-31 18:34:25 +00:00
< form name = "create-list" method = "post" action = "{% url 'list' list.id %}" class = "box hidden" id = "create-list" >
< h3 class = "title" > Edit list< / h3 >
{% include 'lists/form.html' %}
< / form >
2021-01-31 19:45:16 +00:00
{% if pending.exists %}
< div class = "block" >
< div >
< p > {{ pending.count }} book{{pending.count | pluralize }} awaiting your approval< / p >
{% include 'snippets/toggle/open_button.html' with text="Curate suggestions" controls_text="pending-books" class="is-small" %}
< / div >
< div class = "box content hidden" id = "pending-books" >
< header class = "columns is-mobile" >
< h2 class = "column" > Pending Books< / h2 >
< div class = "column is-narrow" >
{% include 'snippets/toggle/toggle_button.html' with label="close" class="delete" nonbutton=True controls_text="pending-books" %}
< / div >
< / header >
< table class = "table is-striped" >
< tr >
< th > < / th >
< th > Book< / th >
< th > Suggested by< / th >
< th > < / th >
< / tr >
{% for item in pending %}
< tr >
< td >
< a href = "{{ book.local_path }}" > {% include 'snippets/book_cover.html' with book=item.book size="small" %}< / a >
< / td >
< td >
{% include 'snippets/book_titleby.html' with book=item.book %}
< / td >
< td >
{% include 'snippets/username.html' with user=item.added_by %}
< / td >
< td class = "field has-addons" >
< div class = "control" >
< button class = "button" > Approve< / button >
< / div >
< div class = "control" >
< button class = "button is-danger is-light" > Reject< / button >
< / div >
< / td >
< / tr >
{% endfor %}
< / table >
< / div >
< / div >
{% endif %}
2021-01-31 18:34:25 +00:00
2021-01-31 17:08:06 +00:00
< div class = "columns content" >
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 18:34:25 +00:00
< li class = "block" >
< div class = "card" >
< header class = "card-header" >
< a href = "{{ book.local_path }}" > {% include 'snippets/book_cover.html' with book=item.book size="medium" %}< / a >
< div class = "card-header-title is-flex-direction-column is-align-items-self-start" >
< span > {% include 'snippets/book_titleby.html' with book=item.book %}< / span >
{% include 'snippets/stars.html' with rating=item.book|rating:request.user %}
{% include 'snippets/shelve_button.html' with book=item.book %}
< / div >
< / header >
{% if item.note %}
< div class = "card-content" >
{% include 'snippets/trimmed_text.html' with full=item.note %}
< / div >
{% endif %}
< div class = "card-footer has-background-white-bis" >
< div class = "card-footer-item" >
< p > Added by {% include 'snippets/username.html' with user=item.added_by %}< / p >
< / div >
2021-01-31 18:44:46 +00:00
{% if list.user == request.user or list.curation == 'open' and item.added_by == request.user %}
2021-01-31 18:34:25 +00:00
< form name = "add-book" method = "post" action = "{% url 'list-add-book' list.id %}" class = "card-footer-item" >
{% csrf_token %}
< input type = "hidden" name = "book" value = "{{ book.id }}" >
< 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 18:34:25 +00:00
{% if not list.curation == 'closed' or request.user == list.user %}
2021-01-31 17:08:06 +00:00
< section class = "column is-one-quarter" >
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 %}
< 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 >
{% 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 %}