fixed up author and publisher drop-down lists to have right id/val, not sure if array subscripting the names will work. To be tested, also removed as many divs and margins and paddings as I can, still dont fully understand why some indent more than others, etc. but it works for now

This commit is contained in:
2020-11-22 23:56:34 +11:00
parent afb132820b
commit 7bd3ff4c26

View File

@@ -25,8 +25,7 @@
{% endfor %}
</div>
{% elif key == "publisher" %}
<div class="col-lg-10">
<div class="form-row input-group" style="margin-left:0px; margin-right:0px;">
<div class="form-row col input-group" style="margin-left:0px; margin-right:0px;">
<div class="input-group-prepend">
<button class="btn btn-outline-primary" type="button">
<a style="color:inherit" href="{{url_for(key, id=books[key][0].id)}}"><i class="far fa-edit"></i></a>
@@ -35,7 +34,7 @@
<select class="form-control" id="publisher">
{% for pub in publisher_list %}
{% set pname=pub.name %}
<option id="{{books.publisher[0].id}}" value="{{books.publisher[0].id}}"
<option id="{{pub.id}}" value="{{pub.id}}"
{% if books.publisher[0].name == pname %}
selected
{% endif %}
@@ -43,10 +42,8 @@
{% endfor %}
</select>
</div class="row">
</div class="col-lg-10">
{% elif key == "author" %}
<div class="col-lg-10">
<div class="form-row" style="margin-left:0px;margin-right:0px">
<div class="form-row col" style="margin-left:0px;margin-right:0px">
{% set cnt = namespace(idx=0) %}
{% for objects in books[key] %}
<div class="col input-group" style="padding-left:0px;padding-right:0px">
@@ -62,10 +59,10 @@
<a style="color:inherit" href="{{url_for(key, id=books[key][cnt.idx].id)}}"><i class="far fa-edit"></i></a>
</button>
</div>
<select class="form-control" id="publisher">
<select class="form-control" id="author[{{cnt.idx}}]">
{% for auth in author_list %}
{% set aname=auth.surname+", "+auth.firstnames %}
<option id="{{books.author[cnt.idx].id}}" value="{{books.author[cnt.idx].id}}"
<option id="{{auth.id}}" value="{{auth.id}}"
{% if books.author[cnt.idx].id == auth.id %}
selected
{% endif %}
@@ -81,11 +78,10 @@
</button>
</div>
</div class="form-row">
</div class="col-lg-10">
{% else %}
<div class="col-lg-10">
<div class="col">
{{book_form[key](class="form-control", value=books[key], rows="5" )}}
</div class="col-lg-10">
</div class="col">
{% endif %}
</div class="form-row">
{% endfor %}