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

View file

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