56 lines
2.0 KiB
HTML
56 lines
2.0 KiB
HTML
<table id="book_table" class="table table-striped table-sm small" data-toolbar="#toolbar" data-search="true">
|
|
<thead>
|
|
<tr class="thead-light"><th>Title</th><th>Book Number</th></tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for book in books %}
|
|
<tr>
|
|
<td>
|
|
{% if book.parent_ref|length %}
|
|
{% set style="visibility: hidden" %}
|
|
{% endif %}
|
|
<a id="up-{{book.id}}" class="btn btn-outline-primary btn-small" style="{{style}}" href="#"><i class="fas fa-angle-double-up"></i></a>
|
|
<a id="down-{{book.id}}" class="btn btn-outline-primary btn-small" style="{{style}}" href="#"><i class="fas fa-angle-double-down"></i></a>
|
|
<a href="/book/{{book.id}}">{{book.title}}</a>
|
|
</td>
|
|
<td data-sort="{{series.id}}.{{"%02d".format( SeriesBookNum( series.id, book.id ))}}">
|
|
{% for s in book.series %}
|
|
{% if not book.child_ref|length %}
|
|
{{ SeriesBookNum( s.id, book.id ) }} of <a href="/series/{{s.id}}">{{s.title}}</a><br>
|
|
{% endif %}
|
|
{% if SeriesBookNum( s.id, book.id ) == 1 %}
|
|
<script>
|
|
{% if book.parent_ref|length %}
|
|
$('#up-{{book.parent_ref[0].book_id}}').addClass("disabled")
|
|
{% else %}
|
|
$('#up-{{book.id}}').addClass("disabled")
|
|
{% endif %}
|
|
</script>
|
|
{% endif %}
|
|
{% if SeriesBookNum( s.id, book.id ) == s.num_books %}
|
|
<script>
|
|
{% if book.parent_ref|length %}
|
|
$('#down-{{book.parent_ref[0].book_id}}').addClass("disabled")
|
|
{% else %}
|
|
$('#down-{{book.id}}').addClass("disabled")
|
|
{% endif %}
|
|
</script>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
|
|
<script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#book_table').DataTable( {
|
|
"paging": false, "searching": false, "info": false,
|
|
"order": [[1, 'asc']],
|
|
"columnDefs": [ { "type": "num", "targets": 1 } ] } );
|
|
} );
|
|
</script>
|
|
|