forgot to git add this - this allows sub books to be a separate route that puts sub books of a parent book in a table, and allows them to be moved up and down

This commit is contained in:
2020-12-01 20:29:08 +11:00
parent 7e67f5bb6f
commit ae9e43964f

View File

@@ -0,0 +1,39 @@
<table class="table table-sm table-striped small">
<thead>
<tr class="thead-light"><th>Title</th><th>Rating</th><th>Author(s)</th><th>Year Published</th><th>Notes</th></tr>
</thead>
<tbody>
{% for book in sub_books %}
<tr>
<td>
{% set state="" %}
{% if loop.index == 1 %}
{% set state="disabled" %}
{% endif %}
<button name="move_button_for" value="up-{{book.sub_book_id}}" id="up-{{book.sub_book_id}}" class="btn btn-outline-primary" {{state}}
onClick="$.ajax({
type: 'POST', url: '/subbooks_for_book/{{book.book_id}}',
data: 'move_button=up-{{book.sub_book_id}}',
success: function(data){
$('#sub_book_content').html(data); }
} ); return false;">
<i class="fas fa-angle-double-up" style="font-size:10px"></i></button>
{% set state="" %}
{% if loop.index == sub_books|length %}
{% set state="disabled" %}
{% endif %}
<button name="move_button" value="down-{{book.sub_book_id}}" id="down-{{book.sub_book_id}}" class="btn btn-outline-primary" {{state}}
onClick="$.ajax({
type: 'POST', url: '/subbooks_for_book/{{book.book_id}}',
data: 'move_button=down-{{book.sub_book_id}}',
success: function(data){
$('#sub_book_content').html(data); }
} ); return false;">
<i class="fas fa-angle-double-down" style="font-size:10px"></i></button>
<a href="/book/{{book.sub_book_id}}">{{book.title}}</a>
- {{book.sub_book_num}}
</td>
<td>{{book.rating}}</td><td>{{book.author}}</td><td>{{book.year_published}}</td><td>{{book.notes}}
</tr>
{% endfor %}
</table>