reordered add button to be consistent with author and publisher, then allowed author to be a drop-down with a + or - button as appropriate

This commit is contained in:
2020-11-22 12:02:01 +11:00
parent 60619c9d9c
commit fc12536a83
3 changed files with 40 additions and 13 deletions

View File

@@ -28,13 +28,13 @@
<div class="col-lg-10">
<div class="form-row 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>
<button class="btn btn-outline-success" type="button">
<a style="color:inherit" href="{{url_for(key, id=-1)}}"><i class="fas fa-plus"></i></a>
</button>
</div>
<div class="input-group-prepend">
<button class="btn btn-outline-success" type="button">
<a style="color:inherit" href="{{url_for(key, id=-1)}}"><i class="fas fa-plus"></i></a>
<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>
</button>
</div>
<select class="form-control" id="publisher">
@@ -51,17 +51,40 @@
</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" style="margin-left:0px;margin-right:0px">
{% set cnt = namespace(idx=0) %}
{% for objects in books[key] %}
<span class="form-control col" id="{{key}}[{{cnt.idx}}]">
<a href="{{url_for(key, id=books[key][cnt.idx].id)}}">
{{books.author[cnt.idx].surname + ", " + books.author[cnt.idx].firstnames}}
</a>
</span>
<div class="col input-group" style="padding-left:0px;padding-right:0px">
<div class="input-group-prepend">
{% if cnt.idx == 0 %}
<button class="btn btn-outline-success" type="button">
<a style="color:inherit" href="{{url_for(key, id=-1)}}"><i class="fas fa-plus"></i></a>
</button>
{% else %}
<button class="btn btn-outline-danger" type="button">
<a style="color:inherit" href="{{url_for(key, id=-1)}}"><i class="fas fa-minus"></i></a>
</button>
{% endif %}
</div>
<div class="input-group-prepend">
<button class="btn btn-outline-primary" type="button">
<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">
{% for auth in author_list %}
{% set aname=auth.surname+", "+auth.firstnames %}
<option id="{{books.author[cnt.idx].id}}" value="{{books.author[cnt.idx].id}}"
{% if books.author[cnt.idx].id == auth.id %}
selected
{% endif %}
>{{aname}}</option>
{% endfor %}
</select>
</div class="col">
{% set cnt.idx = cnt.idx+1 %}
{% endfor %}
</div class="row">
</div class="form-row">
</div class="col-lg-10">
{% else %}
<div class="col-lg-10">