Show related books in links preview

This commit is contained in:
Mouse Reeve 2022-01-10 11:03:10 -08:00
parent 3f280af715
commit 6b0967df39
2 changed files with 32 additions and 13 deletions

View file

@ -9,7 +9,7 @@ from django.utils.translation import gettext_lazy as _
env = Env()
env.read_env()
DOMAIN = env("DOMAIN")
VERSION = "0.1.2"
VERSION = "0.2.0"
PAGE_LENGTH = env("PAGE_LENGTH", 15)
DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English")

View file

@ -35,10 +35,10 @@
<div class="box content">
<div class="columns is-mobile">
<header class="column">
<h3 class="title is-5">
<h2 class="title is-5">
{{ domain.name }}
(<a href="http://{{ domain.domain }}" target="_blank" rel="noopener">{{ domain.domain }}</a>)
</h3>
</h2>
</header>
<div class="column is-narrow">
<button type="button" class="button" data-modal-open="{{ domain_modal }}">
@ -50,23 +50,42 @@
<div class="block">
<details class="details-panel">
<summary>
<span>
<h3 class="title is-6 mb-0">
{% trans "View links" %}
({{ domain.links.count }})
</span>
</h3>
<span class="details-close icon icon-x" aria-hidden></span>
</summary>
<ul>
<div class="table-container mt-4">
<table class="is-striped">
<tr>
<th>{% trans "URL" %}</th>
<th>{% trans "Filetype" %}</th>
<th>{% trans "Book" %}</th>
</tr>
{% for link in domain.links.all|slice:10 %}
<li>
<a href="{{ link.url }}" target="_blank" rel="noopener">{{ link.url }}</a>
{% if link.filelink.filetype %}
({{ link.filelink.filetype }})
{% endif %}
</li>
<tr>
<td>
<a href="{{ link.url }}" target="_blank" rel="noopener">{{ link.url }}</a>
</td>
<td>
{% if link.filelink.filetype %}
{{ link.filelink.filetype }}
{% endif %}
</td>
<td>
{% if link.filelink.filetype %}
{% with book=link.filelink.book %}
<a href="{{ book.local_path }}">{% include "snippets/book_titleby.html" with book=book %}</a>
{% endwith %}
{% endif %}
</td>
</tr>
{% endfor %}
</ul>
</table>
</div>
</details>
</div>