removed all refs to genre_lst, made genre table confirm to id, name, added classes/routes for genre*, tweaked book format to accommodate multiple authors, etc. still 1-line, but with 12 / num of <authors, etc.> col wide form-controls

This commit is contained in:
2020-11-15 14:16:58 +11:00
parent 7334e4b622
commit e39a4da6a2
6 changed files with 119 additions and 20 deletions

View File

@@ -9,12 +9,12 @@
<div class="input-group input-group-lg">
<label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label>
<div class="col-lg-10">
<div class="row">
{% if books[key] is iterable and books[key] is not string %}
{% set cnt = namespace(idx=0, val=0) %}
{% for objects in books[key] %}
{% set cnt.val = 0 %}
{% set str = namespace(val="") %}
<span class="form-control-plaintext" id="{{key}}">
{% for attr in objects %}
{% if attr != "id" %}
{% if cnt.val > 0 %}
@@ -25,12 +25,12 @@
{% set cnt.val = cnt.val + 1 %}
{% endif %}
{% endfor %}
{% if key != "genre" %}
<a href="{{url_for(key, id=books[key][cnt.idx].id)}}">{{str.val}}</a>
{% endif %}
<span class="form-control col-lg-{{((12/books[key]|length)|int)}}" id="{{key}}-{{books[key][cnt.idx].id}}">
<a href="{{url_for(key, id=books[key][cnt.idx].id)}}">{{str.val}}</a>
</span>
{% set cnt.idx = cnt.idx+1 %}
{% endfor %}
</div>
</table>
{% else %}
{% if key == "notes" or key == "blurb" %}

24
templates/genre.html Normal file
View File

@@ -0,0 +1,24 @@
{% extends "base.html" %} {% block main_content %}
<h3><center>Genre</center></h3>
<div class="container">
<right>
{% if message|length %}
<div class="row alert alert-{{alert}}">
{{message}}
</div>
{% endif %}
<div class="row">
<form class="form form-inline col-xl-12" action="" method="POST">
{{ wtf.form_field( genre_form.id, form_type='inline' ) }}
<div class="col-xl-12">
{{ wtf.form_field( genre_form.name, form_type='horizontal', horizontal_columns=('xl', 2, 10), style="width:100%" ) }}
</div>
<div class="col-xl-12">
<br></br>
</div>
{{ wtf.form_field( genre_form.submit, horizontal_columns=('xl', 2, 2), class="btn btn-primary offset-xl-1 col-xl-2" )}}
{{ wtf.form_field( genre_form.delete, horizontal_columns=('xl', 2, 2), class="btn btn-danger offset-xl-1 col-xl-2" )}}
</form>
</div class="row">
</div class="container">
{% endblock main_content %}

15
templates/genres.html Normal file
View File

@@ -0,0 +1,15 @@
{% extends "base.html" %}
{% block main_content %}
<h3>Publishers</h3>
<table id="book_table" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
<thead>
<tr class="thead-light"><th>Surname</th><th>Firstname(s)</th></tr>
</thead>
<tbody>
{% for publisher in publishers %}
<tr><td><a href="{{url_for('publisher', id=publisher.id )}}">{{publisher.name}}</a></td></tr>
{% endfor %}
</tbody>
</table>
{% endblock main_content %}