2021-04-30 11:40:47 -04:00
{% extends 'user/layout.html' %}
2020-12-12 21:25:04 -05:00
{% load bookwyrm_tags %}
2021-05-11 18:14:42 -04:00
{% load utilities %}
2021-03-29 14:48:19 -04:00
{% load humanize %}
2021-02-28 20:10:30 -05:00
{% load i18n %}
2020-11-10 16:39:37 -05:00
2021-03-31 12:22:23 -04:00
{% block title %}
2021-04-30 11:40:47 -04:00
{% include 'user/shelf/books_header.html' %}
2021-03-31 12:22:23 -04:00
{% endblock %}
2021-01-30 15:03:50 -05:00
{% block header %}
< header class = "columns" >
< h1 class = "title" >
2021-04-30 11:40:47 -04:00
{% include 'user/shelf/books_header.html' %}
2021-01-30 15:03:50 -05:00
< / h1 >
< / header >
{% endblock %}
2020-11-10 17:52:04 -05:00
2021-04-30 12:02:14 -04:00
{% block tabs %}
2020-11-10 17:52:04 -05:00
< div class = "block columns" >
< div class = "column" >
2021-02-27 10:53:27 -05:00
< div class = "tabs" >
2020-11-10 17:52:04 -05:00
< ul >
2021-03-31 13:23:20 -04:00
< li class = "{% if shelf.identifier == 'all' %}is-active{% endif %}" >
< a href = "{% url 'user-shelves' user|username %}" { % if shelf . identifier = = ' all ' % } aria-current = "page" { % endif % } > {% trans "All books" %}< / a >
< / li >
2021-02-27 10:53:27 -05:00
{% for shelf_tab in shelves %}
< li class = "{% if shelf_tab.identifier == shelf.identifier %}is-active{% endif %}" >
2021-03-31 12:50:16 -04:00
< a href = "{{ shelf_tab.local_path }}" { % if shelf_tab . identifier = = shelf . identifier % } aria-current = "page" { % endif % } > {% if shelf_tab.identifier == 'to-read' %}{% trans "To Read" %}{% elif shelf_tab.identifier == 'reading' %}{% trans "Currently Reading" %}{% elif shelf_tab.identifier == 'read' %}{% trans "Read" %}{% else %}{{ shelf_tab.name }}{% endif %}< / a >
2021-03-31 13:23:20 -04:00
< / li >
2021-02-27 10:53:27 -05:00
{% endfor %}
2020-11-10 17:52:04 -05:00
< / ul >
< / div >
< / div >
2020-11-10 16:39:37 -05:00
{% if is_self %}
< div class = "column is-narrow" >
2021-02-28 20:10:30 -05:00
{% trans "Create shelf" as button_text %}
2021-05-10 19:13:17 -04:00
{% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="plus" controls_text="create-shelf-form" focus="create-shelf-form-header" %}
< a class = "button" href = "{% url 'import' %}" > {% trans "Import Books" %}< / a >
2020-11-10 16:39:37 -05:00
< / div >
{% endif %}
< / div >
2021-04-30 12:02:14 -04:00
{% endblock %}
2020-11-10 16:39:37 -05:00
2021-04-30 12:02:14 -04:00
{% block panel %}
2021-02-03 15:36:20 -05:00
< div class = "block" >
2021-04-30 11:40:47 -04:00
{% include 'user/shelf/create_shelf_form.html' with controls_text='create-shelf-form' %}
2020-09-29 22:48:10 -04:00
< / div >
2021-02-23 16:04:24 -05:00
< div class = "block columns is-mobile" >
2020-11-10 16:39:37 -05:00
< div class = "column" >
2020-11-10 19:18:48 -05:00
< h2 class = "title is-3" >
{{ shelf.name }}
< span class = "subtitle" >
{% include 'snippets/privacy-icons.html' with item=shelf %}
< / span >
< / h2 >
2020-11-10 16:39:37 -05:00
< / div >
2021-03-31 13:36:10 -04:00
{% if is_self and shelf.id %}
2020-11-10 16:39:37 -05:00
< div class = "column is-narrow" >
2021-02-28 20:10:30 -05:00
{% trans "Edit shelf" as button_text %}
2021-05-18 13:45:51 -04:00
{% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit-shelf-form" focus="edit-shelf-form-header" %}
2020-11-10 16:39:37 -05:00
< / div >
{% endif %}
< / div >
2021-02-03 15:44:51 -05:00
< div class = "block" >
2021-04-30 11:40:47 -04:00
{% include 'user/shelf/edit_shelf_form.html' with controls_text="edit-shelf-form" %}
2020-11-10 23:11:21 -05:00
< / div >
2020-09-29 17:11:55 -04:00
< div class = "block" >
2020-02-21 19:03:05 -05:00
< div >
2021-03-29 14:48:19 -04:00
{% if books|length > 0 %}
2021-04-21 15:25:37 -04:00
< table class = "table is-striped is-fullwidth is-mobile" >
< thead >
< tr >
< th > {% trans "Cover" %}< / th >
< th > {% trans "Title" %}< / th >
< th > {% trans "Author" %}< / th >
< th > {% trans "Shelved" %}< / th >
< th > {% trans "Started" %}< / th >
< th > {% trans "Finished" %}< / th >
2021-05-11 16:54:38 -04:00
{% if request.user.is_authenticated %}
< th > {% trans "Rating" %}< / th >
{% endif %}
2021-04-21 15:25:37 -04:00
{% if shelf.user == request.user %}
< th aria-hidden = "true" > < / th >
{% endif %}
< / tr >
< / thead >
< tbody >
{% for book in books %}
{% spaceless %}
< tr class = "book-preview" >
< td class = "book-preview-top-row" >
2021-04-27 15:35:05 -04:00
< a href = "{{ book.local_path }}" > {% include 'snippets/book_cover.html' with book=book cover_class='is-w-s-tablet is-h-s' %}< / a >
2021-04-21 15:25:37 -04:00
< / td >
< td data-title = "{% trans " Title " % } " >
< a href = "{{ book.local_path }}" > {{ book.title }}< / a >
< / td >
< td data-title = "{% trans " Author " % } " >
{% include 'snippets/authors.html' %}
< / td >
< td data-title = "{% trans " Shelved " % } " >
2021-05-11 18:14:42 -04:00
{{ book.created_date|naturalday }}
2021-04-21 15:25:37 -04:00
< / td >
{% latest_read_through book user as read_through %}
< td data-title = "{% trans " Started " % } " >
2021-05-11 18:14:42 -04:00
{{ read_through.start_date|naturalday|default_if_none:""}}
2021-04-21 15:25:37 -04:00
< / td >
< td data-title = "{% trans " Finished " % } " >
2021-05-11 18:14:42 -04:00
{{ read_through.finish_date|naturalday|default_if_none:""}}
2021-04-21 15:25:37 -04:00
< / td >
2021-05-11 16:54:38 -04:00
{% if request.user.is_authenticated %}
2021-04-21 15:25:37 -04:00
< td data-title = "{% trans " Rating " % } " >
2021-05-11 16:54:38 -04:00
{% include 'snippets/stars.html' with rating=book.rating %}
2021-04-21 15:25:37 -04:00
< / td >
{% endif %}
{% if shelf.user == request.user %}
< td class = "book-preview-top-row has-text-right" >
{% with right=True %}
{% if not shelf.id %}
{% active_shelf book as current %}
{% include 'snippets/shelf_selector.html' with current=current.shelf class="is-small" %}
{% else %}
{% include 'snippets/shelf_selector.html' with current=shelf class="is-small" %}
{% endif %}
{% endwith %}
< / td >
{% endif %}
< / tr >
{% endspaceless %}
{% endfor %}
< / tbody >
2021-03-29 14:48:19 -04:00
< / table >
{% else %}
< p > {% trans "This shelf is empty." %}< / p >
2021-03-31 13:23:20 -04:00
{% if shelf.id and shelf.editable %}
2021-03-29 14:48:19 -04:00
< form name = "delete-shelf" action = "/delete-shelf/{{ shelf.id }}" method = "post" >
{% csrf_token %}
< input type = "hidden" name = "user" value = "{{ request.user.id }}" >
< button class = "button is-danger is-light" type = "submit" >
{% trans "Delete shelf" %}
< / button >
< / form >
{% endif %}
{% endif %}
2020-02-21 19:03:05 -05:00
< / div >
< / div >
2021-03-29 14:48:19 -04:00
< div >
{% include 'snippets/pagination.html' with page=books path=request.path %}
< / div >
2020-02-21 19:03:05 -05:00
{% endblock %}