71 lines
2.7 KiB
HTML
71 lines
2.7 KiB
HTML
{% extends "interface/project_base.html" %}
|
|
{% load url_tools %}
|
|
|
|
{% block admin %}
|
|
{% if collection %}
|
|
<a href="{% url 'work_add' collection.pk %}" class="button is-link">
|
|
<span class="icon"><i class="fas fa-plus-circle"></i></span>
|
|
<span>Add a work</span>
|
|
</a>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block page %}
|
|
<h3 class="title">{{ title }}</h3>
|
|
<form method="GET">
|
|
<div class="field has-addons">
|
|
<div class="control is-expanded">
|
|
<input class="input" name="filter" type="text" placeholder="Filter" value="{{ request.GET.filter }}"/>
|
|
</div>
|
|
<div class="control">
|
|
<a class="button" href="?"><i class="fas fa-times"></i></a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<table class="table is-striped is-fullwidth">
|
|
<thead>
|
|
<tr>
|
|
<th>Work</th>
|
|
<th>Composer</th>
|
|
<th class="is-hidden-mobile">Edition</th>
|
|
{% if not collection %}<th class="is-hidden-touch">Collection</th>{% endif %}
|
|
{% if request.is_admin %}
|
|
<th class="is-hidden-mobile">Copies</th>
|
|
{% endif %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for work in object_list %}
|
|
<tr>
|
|
<td><a href="{% url 'work_detail' collection=work.collection.pk pk=work.pk %}">{{ work.name }}</a></td>
|
|
<td title="{{ work.composer }}">{{ work.composer|truncatewords:3 }}</td>
|
|
<td class="is-hidden-mobile" title="{{ work.edition }}">{{ work.edition|truncatewords:2 }}</td>
|
|
{% if not collection %}<td class="is-hidden-touch">{{ work.collection.name }}</td>{% endif %}
|
|
{% if request.is_admin %}
|
|
<td class="is-hidden-mobile {{ work.is_available|yesno:'has-text-success,has-text-danger' }}">{{ work.available }}</td>
|
|
{% endif %}
|
|
</tr>
|
|
{% empty %}
|
|
<tr><td colspan="4">No works found</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
|
|
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
|
|
{% if page_obj.has_previous %}
|
|
<a class="pagination-previous" href="{% url_update page=page_obj.prev_page_number %}">Previous</a>
|
|
{% endif %}
|
|
{% if page_obj.has_next %}
|
|
<a class="pagination-next" href="{% url_update page=page_obj.next_page_number %}">Next page</a>
|
|
{% endif %}
|
|
<ul class="pagination-list">
|
|
{% for page in page_obj.paginator.page_range %}
|
|
<li>
|
|
<a class="pagination-link {% if forloop.counter == page_obj.number %}is-current{% endif %}" href="{% url_update page=forloop.counter %}" aria-label="Goto page {{ forloop.counter }}">{{ forloop.counter }}</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</nav>
|
|
|
|
{% endblock %} |