2021-08-17 13:57:32 -04:00
{% extends 'layout.html' %}
2022-01-18 14:20:27 -05:00
{% load shelf_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-11-05 20:10:58 -04:00
{% include 'user/books_header.html' with shelf=shelf %}
2021-03-31 12:22:23 -04:00
{% endblock %}
2021-08-17 13:57:32 -04:00
{% block opengraph_images %}
{% include 'snippets/opengraph_images.html' with image=user.preview_image %}
{% endblock %}
{% block content %}
< header class = "block" >
2021-01-30 15:03:50 -05:00
< h1 class = "title" >
2021-09-28 19:04:08 -04:00
{% include 'user/books_header.html' %}
2021-01-30 15:03:50 -05:00
< / h1 >
< / header >
2020-11-10 17:52:04 -05:00
2022-01-11 15:03:04 -05:00
< nav class = "breadcrumb subtitle" aria-label = "breadcrumbs" >
< ul >
< li > < a href = "{% url 'user-feed' user|username %}" > {% trans "User profile" %}< / a > < / li >
< li class = "is-active" >
< a href = "#" aria-current = "page" >
{% include "snippets/translated_shelf_name.html" with shelf=shelf %}
< / a >
< / li >
< / ul >
< / nav >
2021-10-20 16:31:18 -04:00
< nav class = "block columns is-mobile scroll-x" >
< div class = "column pr-0" >
2021-02-27 10:53:27 -05:00
< div class = "tabs" >
2020-11-10 17:52:04 -05:00
< ul >
2021-10-20 16:31:18 -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 >
{% for shelf_tab in shelves %}
< li class = "{% if shelf_tab.identifier == shelf.identifier %}is-active{% endif %}" >
< a
href="{{ shelf_tab.local_path }}"
{% if shelf_tab.identifier == shelf.identifier %} aria-current="page"{% endif %}
>
2022-01-11 15:03:04 -05:00
{% include 'user/books_header.html' with shelf=shelf_tab %}
2021-10-20 16:31:18 -04:00
< / a >
< / li >
{% endfor %}
2020-11-10 17:52:04 -05:00
< / ul >
< / div >
< / div >
2020-11-10 16:39:37 -05:00
{% if is_self %}
2021-10-20 16:31:18 -04:00
< div class = "column is-narrow pl-0" >
< div class = "tabs" >
< ul >
< li >
< a href = "{% url 'import' %}" >
< span class = "icon icon-list" aria-hidden = "true" > < / span >
< span > {% trans "Import Books" %}< / span >
< / a >
< / li >
< / ul >
< / div >
< / div >
2020-11-10 16:39:37 -05:00
< div class = "column is-narrow" >
2021-02-28 20:10:30 -05:00
{% trans "Create shelf" as button_text %}
2021-08-08 21:40:47 -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" %}
2020-11-10 16:39:37 -05:00
< / div >
{% endif %}
2021-10-20 16:31:18 -04:00
< / nav >
2020-11-10 16:39:37 -05:00
2021-02-03 15:36:20 -05:00
< div class = "block" >
2021-09-28 19:04:08 -04:00
{% include 'shelf/create_shelf_form.html' with controls_text='create_shelf_form' %}
2020-09-29 22:48:10 -04:00
< / div >
2021-09-28 20:20:15 -04:00
< div >
< div class = "block columns is-mobile" >
< div class = "column" >
< h2 class = "title is-3" >
2021-12-01 04:07:52 -05:00
{% if shelf.identifier == 'to-read' %}{% trans "To Read" %}
{% elif shelf.identifier == 'reading' %}{% trans "Currently Reading" %}
{% elif shelf.identifier == 'read' %}{% trans "Read" %}
{% else %}{{ shelf.name }}{% endif %}
2021-09-28 20:20:15 -04:00
< span class = "subtitle" >
{% include 'snippets/privacy-icons.html' with item=shelf %}
< / span >
{% with count=books.paginator.count %}
{% if count %}
2022-01-20 17:03:38 -05:00
< span class = "help" >
2021-09-28 20:20:15 -04:00
{% blocktrans trimmed count counter=count with formatted_count=count|intcomma %}
{{ formatted_count }} book
{% plural %}
{{ formatted_count }} books
2021-09-05 17:42:11 -04:00
{% endblocktrans %}
2021-09-28 20:20:15 -04:00
{% if books.has_other_pages %}
{% blocktrans trimmed with start=books.start_index end=books.end_index %}
(showing {{ start }}-{{ end }})
{% endblocktrans %}
{% endif %}
2022-01-20 17:03:38 -05:00
< / span >
2021-09-05 17:42:11 -04:00
{% endif %}
2021-09-28 20:20:15 -04:00
{% endwith %}
< / h2 >
< / div >
{% if is_self and shelf.id %}
< div class = "column is-narrow" >
< div class = "is-flex" >
{% trans "Edit shelf" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_shelf_form" focus="edit_shelf_form_header" %}
2021-09-28 20:17:01 -04:00
2021-09-28 20:20:15 -04:00
{% if shelf.deletable %}
< form class = "ml-1" 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 %}
< / div >
2021-09-28 20:17:01 -04:00
< / div >
2021-09-28 20:20:15 -04:00
{% endif %}
2020-11-10 16:39:37 -05:00
< / div >
2021-09-28 20:20:15 -04:00
{% if shelf.description %}
< p > {{ shelf.description }}< / p >
2020-11-10 16:39:37 -05:00
{% endif %}
< / div >
2021-02-03 15:44:51 -05:00
< div class = "block" >
2021-09-28 19:04:08 -04:00
{% include '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 >
2021-10-11 16:22:12 -04:00
< th > {% trans "Cover"%}< / th >
< th > {% trans "Title" as text %}{% include 'snippets/table-sort-header.html' with field="title" sort=sort text=text %}< / th >
< th > {% trans "Author" as text %}{% include 'snippets/table-sort-header.html' with field="author" sort=sort text=text %}< / th >
2021-10-14 06:39:15 -04:00
{% if request.user.is_authenticated %}
{% if is_self %}
2021-10-11 16:22:12 -04:00
< th > {% trans "Shelved" as text %}{% include 'snippets/table-sort-header.html' with field="shelved_date" sort=sort text=text %}< / th >
< th > {% trans "Started" as text %}{% include 'snippets/table-sort-header.html' with field="start_date" sort=sort text=text %}< / th >
< th > {% trans "Finished" as text %}{% include 'snippets/table-sort-header.html' with field="finish_date" sort=sort text=text %}< / th >
2021-10-14 06:39:15 -04:00
{% endif %}
2021-10-11 16:22:12 -04:00
< th > {% trans "Rating" as text %}{% include 'snippets/table-sort-header.html' with field="rating" sort=sort text=text %}< / th >
2021-05-11 16:54:38 -04:00
{% 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-05-24 10:18: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' size='small' %}< / 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 >
2021-10-14 06:39:15 -04:00
{% if request.user.is_authenticated %}
{% if is_self %}
2021-04-21 15:25:37 -04:00
< td data-title = "{% trans " Shelved " % } " >
2021-07-14 00:25:17 -04:00
{{ book.shelved_date|naturalday }}
2021-04-21 15:25:37 -04:00
< / td >
< td data-title = "{% trans " Started " % } " >
2021-10-11 16:22:12 -04:00
{{ book.start_date|naturalday|default_if_none:""}}
2021-04-21 15:25:37 -04:00
< / td >
< td data-title = "{% trans " Finished " % } " >
2021-10-11 16:22:12 -04:00
{{ book.finish_date|naturalday|default_if_none:""}}
2021-04-21 15:25:37 -04:00
< / td >
2021-10-14 06:39:15 -04:00
{% endif %}
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 %}
2021-08-08 21:40:47 -04:00
{% endfor %}
2021-04-21 15:25:37 -04:00
< / tbody >
2021-03-29 14:48:19 -04:00
< / table >
{% else %}
2021-09-28 19:04:08 -04:00
< p > < em > {% trans "This shelf is empty." %}< / em > < / p >
2021-03-29 14:48:19 -04:00
{% 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 %}