books_for_series now deals with sub books (hiding ability to reorder them in series), and disables first book (parent or normal) and last book (normal or parent of last sub-book)

This commit is contained in:
2020-11-25 17:53:05 +11:00
parent 725c362663
commit 606c3615cf
3 changed files with 29 additions and 14 deletions

View File

@@ -4,6 +4,7 @@
<h3><center>View/Edit Book</center></h1>
{% set keys = [ 'title', 'author', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
{{books.owned}}
<div class="container"><div class="row"><form class="form col-lg-12">
{% for key in keys %}
<div class="form-row">

View File

@@ -6,23 +6,36 @@
{% for book in books %}
<tr>
<td>
{% if SeriesBookNum( series.id, book.id ) == 1 %}
{% set ds="disabled" %}
{% endif %}
<a class="btn btn-outline-primary btn-small {{ds}}" href="#"><i class="fas fa-angle-double-up"></i></a>
{% if SeriesBookNum( series.id, book.id ) == series.num_books %}
{% set de="disabled" %}
{% endif %}
<a class="btn btn-outline-primary btn-small {{de}}" href="#"><i class="fas fa-angle-double-down"></i></a>
{% if book.sub_book_num is defined %}
<a href="/book/{{book.id}}">&nbsp;&nbsp;&nbsp;&nbsp;{{book.title}}</a>
{% else %}
<a href="/book/{{book.id}}">{{book.title}}</a>
{% 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 %}
{{ SeriesBookNum( s.id, book.id ) }} of <a href="/series/{{s.id}}">{{s.title}}</a><br>
{% 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>
@@ -39,3 +52,4 @@
"columnDefs": [ { "type": "num", "targets": 1 } ] } );
} );
</script>