cleaned up tabs on comments in main.py, allowed series edit page to stretch full page, shrank font for books in series table, added move up/down buttons (non-functional as yet), and visualised books being in more than one series

This commit is contained in:
2020-11-24 18:12:28 +11:00
parent a579e7db93
commit 725c362663
3 changed files with 47 additions and 32 deletions

View File

@@ -165,7 +165,8 @@ def books_for_loan(id):
@app.route("/books_for_series/<id>", methods=["GET"])
def books_for_series(id):
books = Book.query.join(Book_Series_Link).filter(Book_Series_Link.series_id==id).order_by(Book.id).all()
return render_template("books_for_series.html", books=books, series_id=id)
series = Series.query.get(id)
return render_template("books_for_series.html", books=books, series=series)
@app.route("/book/<id>", methods=["GET"])
def book(id):

View File

@@ -1,18 +1,30 @@
<h3>Books in Series</h1>
<table id="book_table" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
<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>
{% if book.sub_book_num is defined %}
<td><a href="/book/{{book.id}}">&nbsp;&nbsp;&nbsp;&nbsp;{{book.title}}</a></td>
{% else %}
<td><a href="/book/{{book.id}}">{{book.title}}</a></td>
<td>
{% if SeriesBookNum( series.id, book.id ) == 1 %}
{% set ds="disabled" %}
{% endif %}
<td data-sort="{{series_id, SeriesBookNum( series_id, book.id )}}">{{ SeriesBookNum( series_id, book.id ) }}
</a></td>
<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>
{% endif %}
</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>
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>

View File

@@ -1,14 +1,16 @@
{% extends "base.html" %}
{% block main_content %}
<div class="container">
<h3 class="col-lg-12"><center>Series</center></h3>
<div class="container-fluid">
<div class="row">
<h3 class="col-lg-6"><center>Series</center></h3><h3 class="col-lg-6"><center>Books in Series</center></h3>
</div class="row">
{% if message|length %}
<div class="row alert alert-{{alert}}">
{{message}}
</div>
{% endif %}
<div class="row">
<div class="col-lg-8">
<div class="col-lg-6">
<form class="form form-inline col-lg-12" action="" method="POST">
{{ series_form.csrf_token }}
{{ series_form.id }}
@@ -36,11 +38,11 @@
{{ series_form.submit( class="btn btn-primary col-lg-2" )}}
</div class="form-row">
</form>
</div class="col-lg-8">
<div class="col-lg-4">
</div class="col-lg-6">
<div class="col-lg-6">
<div id="books_for_series_bit">
</div id="books_for_series_bit">
</div class="col-lg-4">
</div class="col-lg-6">
</div class="row">
</div class="container">
{% endblock main_content %}