Merge branch 'book-file-links' into autocomplete
This commit is contained in:
@ -61,24 +61,53 @@
|
||||
|
||||
<div class="columns">
|
||||
<div class="column is-one-fifth">
|
||||
{% include 'snippets/book_cover.html' with size='xxlarge' size_mobile='medium' book=book cover_class='is-h-m-mobile' %}
|
||||
{% if not book.cover %}
|
||||
{% if user_authenticated %}
|
||||
<button
|
||||
type="button"
|
||||
class="cover-container no-cover is-h-m-mobile"
|
||||
data-modal-open="add_cover_{{ book.id }}"
|
||||
>
|
||||
<img
|
||||
class="book-cover"
|
||||
src="{% static "images/no_cover.jpg" %}"
|
||||
alt=""
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span class="cover-caption">
|
||||
<span>{{ book.alt_text }}</span>
|
||||
<span>{% trans "Click to add cover" %}</span>
|
||||
</span>
|
||||
<span class="button-invisible-overlay has-text-centered">
|
||||
{% trans "Click to add cover" %}
|
||||
</span>
|
||||
</button>
|
||||
{% join "add_cover" book.id as modal_id %}
|
||||
{% include 'book/cover_add_modal.html' with id=modal_id %}
|
||||
{% if request.GET.cover_error %}
|
||||
<p class="help is-danger">{% trans "Failed to load cover" %}</p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% include 'snippets/book_cover.html' with book=book cover_class='is-h-m-mobile' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if book.cover %}
|
||||
<button type="button" data-modal-open="cover_show_modal" class="cover-container is-h-m-mobile is-relative">
|
||||
{% include 'snippets/book_cover.html' with size='xxlarge' size_mobile='medium' book=book cover_class='is-h-m-mobile' %}
|
||||
<span class="button-invisible-overlay has-text-centered">
|
||||
{% trans "Click to enlarge" %}
|
||||
</span>
|
||||
</button>
|
||||
{% include 'book/cover_show_modal.html' with book=book id="cover_show_modal" %}
|
||||
{% endif %}
|
||||
|
||||
{% include 'snippets/rate_action.html' with user=request.user book=book %}
|
||||
|
||||
<div class="mb-3">
|
||||
{% include 'snippets/shelve_button/shelve_button.html' %}
|
||||
</div>
|
||||
|
||||
{% if user_authenticated and not book.cover %}
|
||||
<div class="block">
|
||||
{% trans "Add cover" as button_text %}
|
||||
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="add_cover" controls_uid=book.id focus="modal_title_add_cover" class="is-small" %}
|
||||
{% include 'book/cover_modal.html' with book=book controls_text="add_cover" controls_uid=book.id %}
|
||||
{% if request.GET.cover_error %}
|
||||
<p class="help is-danger">{% trans "Failed to load cover" %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<section class="is-clipped">
|
||||
{% with book=book %}
|
||||
<div class="content">
|
||||
@ -93,23 +122,30 @@
|
||||
{% trans "Load data" as button_text %}
|
||||
{% if book.openlibrary_key %}
|
||||
<p>
|
||||
<a href="{{ book.openlibrary_link }}" target="_blank" rel="noopener">{% trans "View on OpenLibrary" %}</a>
|
||||
<a href="{{ book.openlibrary_link }}" target="_blank" rel="noopener">
|
||||
{% trans "View on OpenLibrary" %}
|
||||
</a>
|
||||
{% if request.user.is_authenticated and perms.bookwyrm.edit_book %}
|
||||
{% with controls_text="ol_sync" controls_uid=book.id %}
|
||||
{% include 'snippets/toggle/toggle_button.html' with text=button_text focus="modal_title_ol_sync" class="is-small" icon_with_text="download" %}
|
||||
{% include "book/sync_modal.html" with source="openlibrary.org" source_name="OpenLibrary" %}
|
||||
{% endwith %}
|
||||
<button class="button is-small" type="button" data-modal-open="openlibrary_sync">
|
||||
<span class="icon icon-download" title="{{ button_text }}"></span>
|
||||
<span class="is-sr-only-mobile">{{ button_text }}</span>
|
||||
</button>
|
||||
{% include "book/sync_modal.html" with source="openlibrary.org" source_name="OpenLibrary" id="openlibrary_sync" %}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if book.inventaire_id %}
|
||||
<p>
|
||||
<a href="{{ book.inventaire_link }}" target="_blank" rel="noopener">{% trans "View on Inventaire" %}</a>
|
||||
<a href="{{ book.inventaire_link }}" target="_blank" rel="noopener">
|
||||
{% trans "View on Inventaire" %}
|
||||
</a>
|
||||
|
||||
{% if request.user.is_authenticated and perms.bookwyrm.edit_book %}
|
||||
{% with controls_text="iv_sync" controls_uid=book.id %}
|
||||
{% include 'snippets/toggle/toggle_button.html' with text=button_text focus="modal_title_iv_sync" class="is-small" icon_with_text="download" %}
|
||||
{% include "book/sync_modal.html" with source="inventaire.io" source_name="Inventaire" %}
|
||||
{% endwith %}
|
||||
<button class="button is-small" type="button" data-modal-open="inventaire_sync">
|
||||
<span class="icon icon-download" title="{{ button_text }}"></span>
|
||||
<span class="is-sr-only-mobile">{{ button_text }}</span>
|
||||
</button>
|
||||
{% include "book/sync_modal.html" with source="inventaire.io" source_name="Inventaire" id="inventaire_sync" %}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
@ -347,32 +383,7 @@
|
||||
{% endif %}
|
||||
|
||||
<section class="content block">
|
||||
<header class="columns is-mobile mb-0">
|
||||
<div class="column">
|
||||
<h2 class="title is-5">{% trans "Get a copy" %}</h2>
|
||||
</div>
|
||||
{% if can_edit_book %}
|
||||
<div class="column is-narrow">
|
||||
{% trans "Add link to copy" as button_text %}
|
||||
{% url 'file-link' book.id as fallback_url %}
|
||||
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="edit_file_links" controls_uid=book.id focus="modal_title_edit_file_links" class="is-small" icon="plus" fallback_url=fallback_url %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</header>
|
||||
{% if book.file_links %}
|
||||
<ul class="mt-0">
|
||||
{% for link in book.file_links.all %}
|
||||
<li>
|
||||
<a href="{{ link.url }}" rel="noopener" target="_blank" title="{{ link.url }}">{{ link.name }}</a>
|
||||
({{ link.filetype }})
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if can_edit_book %}
|
||||
{% include 'book/file_link_modal.html' with book=book controls_text="edit_file_links" controls_uid=book.id %}
|
||||
{% endif %}
|
||||
{% include "book/links.html" %}
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -29,8 +29,7 @@
|
||||
|
||||
{% block modal-footer %}
|
||||
<button class="button is-primary" type="submit">{% trans "Add" %}</button>
|
||||
{% trans "Cancel" as button_text %}
|
||||
{% include 'snippets/toggle/toggle_button.html' with text=button_text %}
|
||||
<button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
|
||||
{% endblock %}
|
||||
{% block modal-form-close %}</form>{% endblock %}
|
||||
|
||||
{% block modal-form-close %}</form>{% endblock %}
|
12
bookwyrm/templates/book/cover_show_modal.html
Normal file
12
bookwyrm/templates/book/cover_show_modal.html
Normal file
@ -0,0 +1,12 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
|
||||
<div class="modal" id="{{ id }}">
|
||||
<div class="modal-background" data-modal-close></div><!-- modal background -->
|
||||
<div class="modal-card is-align-items-center" role="dialog" aria-modal="true" tabindex="-1" aria-label="{% trans 'Book cover preview' %}">
|
||||
<div class="cover-container">
|
||||
<img class="book-cover" src="{% get_media_prefix %}{{ book.cover }}" itemprop="thumbnailUrl" alt="">
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" data-modal-close class="modal-close is-large" aria-label="{% trans 'Close' %}"></button>
|
||||
</div>
|
25
bookwyrm/templates/book/delete_readthrough_modal.html
Normal file
25
bookwyrm/templates/book/delete_readthrough_modal.html
Normal file
@ -0,0 +1,25 @@
|
||||
{% extends 'components/modal.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block modal-title %}{% trans "Delete these read dates?" %}{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
{% if readthrough.progress_updates|length > 0 %}
|
||||
{% blocktrans trimmed with count=readthrough.progress_updates|length %}
|
||||
You are deleting this readthrough and its {{ count }} associated progress updates.
|
||||
{% endblocktrans %}
|
||||
{% else %}
|
||||
{% trans "This action cannot be un-done" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<form name="delete-readthrough-{{ readthrough.id }}" action="/delete-readthrough" method="POST">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="id" value="{{ readthrough.id }}">
|
||||
<button class="button is-danger" type="submit">
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
<button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
|
||||
</form>
|
||||
{% endblock %}
|
@ -13,11 +13,11 @@
|
||||
{% block modal-body %}
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="book" value="{{ book.id }}">
|
||||
<div class="field">
|
||||
<label class="label" for="id_url">{% trans "Name:" %}</label>
|
||||
{{ file_link_form.name }}
|
||||
{% include 'snippets/form_errors.html' with errors_list=file_link_form.name.errors id="desc_name" %}
|
||||
</div>
|
||||
<input type="hidden" name="added_by" value="{{ request.user.id }}">
|
||||
|
||||
<p class="notification">
|
||||
{% trans "Links from unknown domains will need to be approved by a moderator before they are added." %}
|
||||
</p>
|
||||
|
||||
<div class="columns">
|
||||
<div class="column is-four-fifths">
|
||||
@ -37,8 +37,7 @@
|
||||
{% block modal-footer %}
|
||||
<button class="button is-primary" type="submit">{% trans "Save" %}</button>
|
||||
{% if not static %}
|
||||
{% trans "Cancel" as button_text %}
|
||||
{% include 'snippets/toggle/toggle_button.html' with text=button_text %}
|
||||
<button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -6,5 +6,5 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include "book/file_link_modal.html" with book=book active=True static=True %}
|
||||
{% include "book/file_link_modal.html" with book=book active=True static=True id="file-link" %}
|
||||
{% endblock %}
|
||||
|
29
bookwyrm/templates/book/link_verification_modal.html
Normal file
29
bookwyrm/templates/book/link_verification_modal.html
Normal file
@ -0,0 +1,29 @@
|
||||
{% extends 'components/modal.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block modal-title %}
|
||||
{% trans "Leaving BookWyrm" %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block modal-body %}
|
||||
|
||||
{% blocktrans trimmed with link_url=link.url %}
|
||||
This link is taking you to: <code>{{ link_url }}</code>.<br>
|
||||
Is that where you'd like to go?
|
||||
{% endblocktrans %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block modal-footer %}
|
||||
<a href="{{ link.url }}" target="_blank" rel="noopener" class="button is-primary">{% trans "Continue" %}</a>
|
||||
<button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
|
||||
|
||||
{% if request.user.is_authenticated %}
|
||||
<div class="has-text-right is-flex-grow-1">
|
||||
<a href="{% url 'report-link' link.added_by.id link.id %}">{% trans "Report spam" %}</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
46
bookwyrm/templates/book/links.html
Normal file
46
bookwyrm/templates/book/links.html
Normal file
@ -0,0 +1,46 @@
|
||||
{% load i18n %}
|
||||
{% load bookwyrm_tags %}
|
||||
{% load utilities %}
|
||||
|
||||
{% get_book_file_links book as links %}
|
||||
{% if links.exists or request.user.is_authenticated %}
|
||||
<header class="columns is-mobile mb-0">
|
||||
<div class="column">
|
||||
<h2 class="title is-5">{% trans "Get a copy" %}</h2>
|
||||
</div>
|
||||
{% if can_edit_book %}
|
||||
<div class="column is-narrow">
|
||||
{% url 'file-link' book.id as fallback_url %}
|
||||
<button class="button is-small" type="button" data-modal-open="edit-links">
|
||||
<span class="icon icon-plus">
|
||||
<span class="is-sr-only">
|
||||
{% trans "Add link to copy" %}
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</header>
|
||||
{% if links %}
|
||||
<ul class="mt-0">
|
||||
{% for link in links.all %}
|
||||
{% join "verify" link.id as verify_modal %}
|
||||
<li>
|
||||
<a href="{{ link.url }}" rel="noopener" target="_blank" title="{{ link.url }}" data-modal-open="{{ verify_modal }}">{{ link.name }}</a>
|
||||
({{ link.filetype }})
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% for link in links.all %}
|
||||
{% join "verify" link.id as verify_modal %}
|
||||
{% include "book/link_verification_modal.html" with id=verify_modal %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<em>{% trans "No links available" %}</em>
|
||||
{% endif %}
|
||||
|
||||
{% if can_edit_book %}
|
||||
{% include 'book/file_link_modal.html' with book=book id="edit-links" %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
@ -1,6 +1,7 @@
|
||||
{% load i18n %}
|
||||
{% load humanize %}
|
||||
{% load tz %}
|
||||
{% load utilities %}
|
||||
<div class="content">
|
||||
<div id="hide_edit_readthrough_{{ readthrough.id }}" class="box is-shadowless has-background-white-bis">
|
||||
<div class="columns">
|
||||
@ -10,14 +11,14 @@
|
||||
{% if readthrough.finish_date or readthrough.progress %}
|
||||
<li>
|
||||
{% if readthrough.finish_date %}
|
||||
{{ readthrough.finish_date | localtime | naturalday }}: {% trans "finished" %}
|
||||
{{ readthrough.finish_date | localtime | naturalday }}: {% trans "finished" %}
|
||||
{% else %}
|
||||
|
||||
{% if readthrough.progress_mode == 'PG' %}
|
||||
{% include 'snippets/page_text.html' with page=readthrough.progress total_pages=book.pages %}
|
||||
{% else %}
|
||||
{{ readthrough.progress }}%
|
||||
{% endif %}
|
||||
{% if readthrough.progress_mode == 'PG' %}
|
||||
{% include 'snippets/page_text.html' with page=readthrough.progress total_pages=book.pages %}
|
||||
{% else %}
|
||||
{{ readthrough.progress }}%
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if readthrough.progress %}
|
||||
@ -47,6 +48,7 @@
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if readthrough.start_date %}
|
||||
<li>{{ readthrough.start_date | localtime | naturalday }}: {% trans "started" %}</li>
|
||||
{% endif %}
|
||||
@ -60,7 +62,11 @@
|
||||
</div>
|
||||
<div class="control">
|
||||
{% trans "Delete these read dates" as button_text %}
|
||||
{% include 'snippets/toggle/toggle_button.html' with class="is-small" text=button_text icon="x" controls_text="delete_readthrough" controls_uid=readthrough.id focus="modal_title_delete_readthrough" %}
|
||||
<button class="button is-small" type="button" data-modal-open="delete_readthrough_{{ readthrough.id }}">
|
||||
<span class="icon icon-x" title="{{ button_text }}">
|
||||
<span class="is-sr-only">{{ button_text }}</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -79,4 +85,5 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% include 'snippets/delete_readthrough_modal.html' with controls_text="delete_readthrough" controls_uid=readthrough.id no_body=True %}
|
||||
{% join "delete_readthrough" readthrough.id as modal_id %}
|
||||
{% include 'book/delete_readthrough_modal.html' with id=modal_id %}
|
||||
|
@ -19,12 +19,8 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<button class="button is-primary" type="submit">
|
||||
<span>{% trans "Confirm" %}</span>
|
||||
</button>
|
||||
|
||||
{% trans "Cancel" as button_text %}
|
||||
{% include 'snippets/toggle/toggle_button.html' with text=button_text %}
|
||||
<button class="button is-primary" type="submit">{% trans "Confirm" %}</button>
|
||||
<button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-form-close %}</form>{% endblock %}
|
||||
|
Reference in New Issue
Block a user