moviewyrm/bookwyrm/templates/book/links.html

53 lines
1.7 KiB
HTML
Raw Normal View History

2022-01-10 04:30:23 +00:00
{% load i18n %}
{% load bookwyrm_tags %}
2022-01-10 19:47:52 +00:00
{% load utilities %}
2022-01-10 04:30:23 +00:00
{% get_book_file_links book as links %}
2022-01-10 19:52:00 +00:00
{% if links.exists or request.user.is_authenticated %}
2022-01-10 04:30:23 +00:00
<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">
2022-01-12 17:52:26 +00:00
{% url 'file-link-add' book.id as fallback_url %}
2022-01-12 18:07:49 +00:00
<form name="add-link" method="get" action="{{ fallback_url }}">
<button class="button is-small" type="submit" data-modal-open="add-links">
<span class="icon icon-plus">
<span class="is-sr-only">
{% trans "Add link to file" %}
</span>
2022-01-10 04:30:23 +00:00
</span>
2022-01-12 18:07:49 +00:00
</button>
</form>
2022-01-10 04:30:23 +00:00
</div>
{% endif %}
</header>
{% if links %}
<ul class="mt-0">
{% for link in links.all %}
2022-01-10 19:47:52 +00:00
{% join "verify" link.id as verify_modal %}
2022-01-10 04:30:23 +00:00
<li>
2022-01-10 19:47:52 +00:00
<a href="{{ link.url }}" rel="noopener" target="_blank" title="{{ link.url }}" data-modal-open="{{ verify_modal }}">{{ link.name }}</a>
2022-01-10 04:30:23 +00:00
({{ link.filetype }})
</li>
{% endfor %}
</ul>
2022-01-10 19:47:52 +00:00
{% for link in links.all %}
{% join "verify" link.id as verify_modal %}
{% include "book/link_verification_modal.html" with id=verify_modal %}
{% endfor %}
2022-01-10 19:52:00 +00:00
{% else %}
<em>{% trans "No links available" %}</em>
2022-01-10 04:30:23 +00:00
{% endif %}
2022-01-12 17:52:26 +00:00
{% if can_edit_book and links.exists %}
<a href="{% url 'file-link' book.id %}" class="is-pulled-right">
<span class="icon icon-pencil" aria-hidden="true"></span>
<span>{% trans "Edit links" %}</span>
</a>
{% include 'book/file_link_modal.html' with book=book id="add-links" %}
2022-01-10 04:30:23 +00:00
{% endif %}
2022-01-10 19:52:00 +00:00
{% endif %}