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 = Env()
env.read_env() env.read_env()
DOMAIN = env("DOMAIN") DOMAIN = env("DOMAIN")
VERSION = "0.1.2" VERSION = "0.2.0"
PAGE_LENGTH = env("PAGE_LENGTH", 15) PAGE_LENGTH = env("PAGE_LENGTH", 15)
DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English") DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English")

View file

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