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:
2
main.py
2
main.py
@@ -109,7 +109,7 @@ class BookSchema(ma.SQLAlchemyAutoSchema):
|
|||||||
publisher = ma.Nested(PublisherSchema, many=True)
|
publisher = ma.Nested(PublisherSchema, many=True)
|
||||||
genre = ma.Nested(GenreSchema, many=True)
|
genre = ma.Nested(GenreSchema, many=True)
|
||||||
loan = ma.Nested(LoanSchema, many=True)
|
loan = ma.Nested(LoanSchema, many=True)
|
||||||
series = ma.Nested(Book_Series_LinkSchema, many=True)
|
series = ma.Nested(SeriesSchema, many=True)
|
||||||
parent_ref = ma.Nested(Book_Sub_Book_LinkSchema, many=True)
|
parent_ref = ma.Nested(Book_Sub_Book_LinkSchema, many=True)
|
||||||
child_ref = ma.Nested(Book_Sub_Book_LinkSchema, many=True)
|
child_ref = ma.Nested(Book_Sub_Book_LinkSchema, many=True)
|
||||||
class Meta: model = Book
|
class Meta: model = Book
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
<h3><center>View/Edit Book</center></h1>
|
<h3><center>View/Edit Book</center></h1>
|
||||||
{% set keys = [ 'title', 'author', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
|
{% 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">
|
<div class="container"><div class="row"><form class="form col-lg-12">
|
||||||
{% for key in keys %}
|
{% for key in keys %}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
|||||||
@@ -6,23 +6,36 @@
|
|||||||
{% for book in books %}
|
{% for book in books %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{% if SeriesBookNum( series.id, book.id ) == 1 %}
|
{% if book.parent_ref|length %}
|
||||||
{% set ds="disabled" %}
|
{% set style="visibility: hidden" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="btn btn-outline-primary btn-small {{ds}}" href="#"><i class="fas fa-angle-double-up"></i></a>
|
<a id="up-{{book.id}}" class="btn btn-outline-primary btn-small" style="{{style}}" href="#"><i class="fas fa-angle-double-up"></i></a>
|
||||||
{% if SeriesBookNum( series.id, book.id ) == series.num_books %}
|
<a id="down-{{book.id}}" class="btn btn-outline-primary btn-small" style="{{style}}" href="#"><i class="fas fa-angle-double-down"></i></a>
|
||||||
{% 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}}"> {{book.title}}</a>
|
|
||||||
{% else %}
|
|
||||||
<a href="/book/{{book.id}}">{{book.title}}</a>
|
<a href="/book/{{book.id}}">{{book.title}}</a>
|
||||||
{% endif %}
|
|
||||||
</td>
|
</td>
|
||||||
<td data-sort="{{series.id}}.{{"%02d".format( SeriesBookNum( series.id, book.id ))}}">
|
<td data-sort="{{series.id}}.{{"%02d".format( SeriesBookNum( series.id, book.id ))}}">
|
||||||
{% for s in book.series %}
|
{% 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>
|
{{ 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 %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -39,3 +52,4 @@
|
|||||||
"columnDefs": [ { "type": "num", "targets": 1 } ] } );
|
"columnDefs": [ { "type": "num", "targets": 1 } ] } );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user