move parent[] to parent as the array was never needed, removed some dead code, clarified another example of new BUG-46

This commit is contained in:
2023-07-08 15:10:38 +10:00
parent ff87aca2f5
commit 4e8bda4134
6 changed files with 27 additions and 44 deletions

View File

@@ -221,17 +221,17 @@ function AddAuthorToBook(num) {
<form role="form" class="form" action="" method="POST">
{{ book_form.id }}
{{ book_form.csrf_token }}
{% if b.parent|length %}
{% if b.parent %}
<div class="form-row">
<div class="input-group">
<label class="input-group-text col-2 col-form-label bg-secondary text-white"><i>Parent Book:</i></label>
<div class="col">
<span class="col-12 d-flex h-100 border rounded-end border-primary">
<i class="col-12 d-flex h-100 justify-content-center"><a href="/book/{{b.parent[0].id}}">{{b.parent[0].title}}</a></i>
<i class="col-12 d-flex h-100 justify-content-center"><a href="/book/{{b.parent.id}}">{{b.parent.title}}</a></i>
</span>
</div>
<input type="hidden" name="parent_id" value="{{b.parent[0].id}}">
<input type="hidden" name="parent_title" value="{{b.parent[0].title}}">
<input type="hidden" name="parent_id" value="{{b.parent.id}}">
<input type="hidden" name="parent_title" value="{{b.parent.title}}">
</div>
</div>
{% endif %}
@@ -303,7 +303,7 @@ function AddAuthorToBook(num) {
{% if key == "notes" %}
{% set rows=2 %}
{% endif %}
{% if b.parent|length and
{% if b.parent and
(key == 'publisher' or key == 'owned' or key == 'covertype'
or key == 'condition' or key == 'blurb' ) %}
{{book_form[key](class="form-control", rows=rows, disabled="disabled" )}}
@@ -426,7 +426,7 @@ function AddAuthorToBook(num) {
{% else %}
<div class="form-row">
{% endif %}
{% if b.parent|length == 0 %}
{% if b.parent %}
<form role="form" class="form" action="{{url_for('new_book')}}" method="POST">
<input type="hidden" name="add_sub_parent_id" value="{{books.id}}">
{{ book_form.add_sub( class="btn btn-outline-success offset-2 col-2" )}}
@@ -434,7 +434,7 @@ function AddAuthorToBook(num) {
{% else %}
<form role="form" class="form" action="{{url_for('remove_sub_book')}}" method="POST">
<input type="hidden" name="rem_sub_sub_book_id" value="{{books.id}}">
<input type="hidden" name="rem_sub_parent_id" value="{{b.parent[0].id}}">
<input type="hidden" name="rem_sub_parent_id" value="{{b.parent.id}}">
{{ book_form.rem_sub( class="btn btn-outline-danger offset-2 col-3" )}}
</form>
{% endif %}