fixed BUG-11, parent was both an array (in Book) and not an array in QuickBook, so made them arrays to keep with ORM-way

This commit is contained in:
2021-01-02 18:53:52 +11:00
parent 3c47063ee2
commit 4c442e1fea
3 changed files with 50 additions and 34 deletions

View File

@@ -135,10 +135,10 @@ function AddAuthorToBook(num) {
<label class="col-lg-2 col-form-label bg-secondary text-white">Parent Book:</label>
<div class="col">
<button disabled class="col btn btn-outline-primary">
<i><a href="/book/{{b.parent.id}}">{{b.parent.title}}</a></i>
<i><a href="/book/{{b.parent[0].id}}">{{b.parent[0].title}}</a></i>
</button>
</div>
<input type="hidden" name="parent_id" value="{{b.parent.id}}">
<input type="hidden" name="parent_id" value="{{b.parent[0].id}}">
</div>
{% endif %}
{% for key in keys %}
@@ -295,11 +295,18 @@ function AddAuthorToBook(num) {
</div class="form-row">
{{ hiddens.txt|safe }}
</form>
{% if b.parent|length == 0 and 'Edit' in page_title %}
<form role="form" class="form col-lg-10" 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-lg-2 col-lg-2" )}}
</form>
{% if 'Edit' in page_title %}
{% if b.parent|length == 0 %}
<form role="form" class="form col-lg-10" 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-lg-2 col-lg-2" )}}
</form>
{% else %}
<form role="form" class="form col-lg-10" action="{{url_for('remove_sub_book')}}" method="POST">
<input type="hidden" name="rem_sub_parent_id" value="{{books.id}}">
{{ book_form.rem_sub( class="btn btn-outline-danger offset-lg-2 col-lg-3" )}}
</form>
{% endif %}
{% endif %}
{% if books.loan|length %}
<div class="col">