More flexible templates

This commit is contained in:
Mouse Reeve 2021-11-13 09:34:10 -08:00
parent acc32d579e
commit 60fb1ac2e6
2 changed files with 22 additions and 39 deletions

View file

@ -70,7 +70,6 @@
</h2>
{% block actions %}{% endblock %}
<table class="table">
{% block table_headers %}
<tr>
<th>
{% trans "Row" %}
@ -84,23 +83,28 @@
<th>
{% trans "Author" %}
</th>
<th>
{% trans "Shelf" %}
</th>
<th>
{% trans "Review" %}
</th>
{% block import_cols_headers %}
<th>
{% trans "Book" %}
</th>
<th>
{% trans "Status" %}
</th>
{% endblock %}
</tr>
{% endblock %}
{% for item in items %}
{% block table_row %}
<tr>
{% block index_col %}
<td>
{{ item.index }}
</td>
{% endblock %}
<td>
{{ item.normalized_data.title }}
</td>
@ -110,10 +114,14 @@
<td>
{{ item.normalized_data.authors }}
</td>
<td>
{{ item.normalized_data.shelf }}
</td>
<td>
<p>{% include 'snippets/stars.html' with rating=item.rating %}</p>
<p>{{ item.review|truncatechars:100 }}</p>
</td>
{% block import_cols %}
<td>
{% if item.book %}
<a href="{{ item.book.local_path }}">
@ -136,8 +144,9 @@
<span class="is-sr-only-mobile">{% trans "Pending" %}</span>
{% endif %}
</td>
{% endblock %}
</tr>
{% endblock %}
{% block action_row %}{% endblock %}
{% endfor %}
</table>
</div>

View file

@ -18,47 +18,19 @@
</div>
{% endblock %}
{% block table_headers %}
<tr>
<th>
{% trans "Row" %}
</th>
<th>
{% trans "Title" %}
</th>
<th>
{% trans "ISBN" %}
</th>
<th>
{% trans "Author" %}
</th>
<th>
{% trans "Review" %}
</th>
{% block import_cols_headers %}
<th>
{% trans "Actions" %}
</th>
</tr>
{% endblock %}
{% block table_row %}
<tr>
{% block index_col %}
<td rowspan="2">
{{ item.index }}
</td>
<td>
{{ item.normalized_data.title }}
</td>
<td>
{{ item.isbn }}
</td>
<td>
{{ item.normalized_data.authors }}
</td>
<td>
<p>{% include 'snippets/stars.html' with rating=item.rating %}</p>
<p>{{ item.review|truncatechars:100 }}</p>
</td>
{% endblock %}
{% block import_cols %}
<td>
<div class="content is-flex">
<form class="pr-2" name="approve-{{ item.id }}" method="POST" action="{% url 'import-approve' job.id item.id %}">
@ -78,9 +50,11 @@
</form>
</div>
</td>
</tr>
{% endblock %}
{% block action_row %}
<tr>
<td colspan="5">
<td colspan="6">
<div class="columns is-mobile">
{% with guess=item.book_guess %}
<div class="column is-narrow">