adding a sub-book now works

This commit is contained in:
2020-12-26 19:11:43 +11:00
parent 6a72c6d9dd
commit 61629760cd
3 changed files with 64 additions and 47 deletions

View File

@@ -142,6 +142,7 @@ function AddAuthorToBook(num) {
<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[0].id}}">
</div>
{% endif %}
{% for key in keys %}
@@ -208,9 +209,11 @@ function AddAuthorToBook(num) {
{% if b.parent|length and
(key == 'publisher' or key == 'owned' or key == 'covertype'
or key == 'condition' or key == 'blurb' ) %}
{{book_form[key](class="form-control", value=books[key], rows=rows, disabled="disabled" )}}
{{book_form[key](class="form-control", rows=rows, disabled="disabled" )}}
{# disabled fields do not come through in form post, so add hidden to make it work #}
<input type="hidden" name={{key}} value={{book_form[key].data}}>
{% else %}
{{book_form[key](class="form-control", value=books[key], rows=rows )}}
{{book_form[key](class="form-control", rows=rows )}}
{% endif %}
</div class="col">
{% endif %}
@@ -290,14 +293,16 @@ function AddAuthorToBook(num) {
<div class="form-row col mx-0">
{{ book_form.delete( class="btn btn-outline-danger offset-lg-2 col-lg-2" )}}
{{ book_form.submit( class="btn btn-primary col-lg-2" )}}
{% if b.parent|length == 0 %}
<input type="hidden" name="add_sub_parent_id" value="{{books.id}}">
{{ book_form.add_sub( class="btn btn-outline-success offset-lg-4 col-lg-2" )}}
{% endif %}
</div class="form-row">
</div class="form-row">
{{ hiddens.txt|safe }}
</form>
{% 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>
{% endif %}
{% if books.loan|length %}
<div class="col">
<div class="card border-primary">