added edit author button/link, and fixed broken hover since I changed to bals from author. Also removed the old author code, finally made it so when you hover over remove button we now also highlight the edit button for the author to be red as well. Hovering over edit link higlights the relevant author blue to let you know which one you will go to
This commit is contained in:
@@ -200,10 +200,6 @@ function AddAuthorToBook(num) {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#
|
|
||||||
{% set keys = [ 'title', 'bals', 'author', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
|
|
||||||
#}
|
|
||||||
|
|
||||||
{% set keys = [ 'title', 'bals', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
|
{% set keys = [ 'title', 'bals', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="form-row"><h3 class="offset-2">{{page_title}}</h3></div>
|
<div class="form-row"><h3 class="offset-2">{{page_title}}</h3></div>
|
||||||
@@ -257,6 +253,11 @@ function AddAuthorToBook(num) {
|
|||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<button id="author-edit-{{cnt.idx}}" class="btn" type="button" onclick="window.location.href='/author/{{a.author.id}}'">
|
||||||
|
<svg width="22" height="22" fill="currentColor">
|
||||||
|
<use xlink:href="{{url_for('static', filename='icons.svg')}}#edit"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
<select class="form-select input-group-append" name="author-{{cnt.idx}}" id="author-{{cnt.idx}}">
|
<select class="form-select input-group-append" name="author-{{cnt.idx}}" id="author-{{cnt.idx}}">
|
||||||
{% for auth in author_list %}
|
{% for auth in author_list %}
|
||||||
{% set aname=auth.surname+", "+auth.firstnames %}
|
{% set aname=auth.surname+", "+auth.firstnames %}
|
||||||
@@ -283,39 +284,6 @@ function AddAuthorToBook(num) {
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<svg width="22" height="22" fill="currentColor"><use xlink:href="{{url_for('static', filename='icons.svg')}}#plus"/></svg>
|
<svg width="22" height="22" fill="currentColor"><use xlink:href="{{url_for('static', filename='icons.svg')}}#plus"/></svg>
|
||||||
</button>
|
</button>
|
||||||
{% elif key == "author" %}
|
|
||||||
{% set cnt = namespace(idx=0) %}
|
|
||||||
{% for objects in books[key] %}
|
|
||||||
{% if cnt.idx > 0 %}
|
|
||||||
<button id="author-rem-{{cnt.idx}}" class="btn btn-outline-danger input-group-append" type="button" onClick="RemoveAuthorFromBook({{cnt.idx}})">
|
|
||||||
<svg width="22" height="22" fill="currentColor">
|
|
||||||
<use xlink:href="{{url_for('static', filename='icons.svg')}}#minus"/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
<select class="form-select input-group-append" name="author-{{cnt.idx}}" id="author-{{cnt.idx}}">
|
|
||||||
{% for auth in author_list %}
|
|
||||||
{% set aname=auth.surname+", "+auth.firstnames %}
|
|
||||||
<option value="{{auth.id}}"
|
|
||||||
{% if books.author[cnt.idx].id == auth.id %}
|
|
||||||
selected
|
|
||||||
{% endif %}
|
|
||||||
>{{aname}}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
{% set cnt.idx = cnt.idx+1 %}
|
|
||||||
{% endfor %}
|
|
||||||
{% if cnt.idx == 0 %}
|
|
||||||
<select class="form-select input-group-append" name="author-{{cnt.idx}}" id="author-{{cnt.idx}}">
|
|
||||||
{% for auth in author_list %}
|
|
||||||
{% set aname=auth.surname+", "+auth.firstnames %}
|
|
||||||
<option value="{{auth.id}}">{{aname}}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
{% endif %}
|
|
||||||
<button id="author-plus" class="btn btn-outline-success input-group-append" type="button" onClick="AddAuthorToBook({{cnt.idx}})">
|
|
||||||
<svg width="22" height="22" fill="currentColor"><use xlink:href="{{url_for('static', filename='icons.svg')}}#plus"/></svg>
|
|
||||||
</button>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set rows=4 %}
|
{% set rows=4 %}
|
||||||
{% if key == "notes" %}
|
{% if key == "notes" %}
|
||||||
@@ -459,6 +427,7 @@ function AddAuthorToBook(num) {
|
|||||||
|
|
||||||
{% endblock main_content %}
|
{% endblock main_content %}
|
||||||
{% if books.child_ref|length %}
|
{% if books.child_ref|length %}
|
||||||
|
{% endif %}
|
||||||
{% block script_content %}
|
{% block script_content %}
|
||||||
<script>
|
<script>
|
||||||
$(document).ready( function() {
|
$(document).ready( function() {
|
||||||
@@ -474,14 +443,24 @@ function AddAuthorToBook(num) {
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set cnt = namespace(idx=1) %}
|
{% set cnt = namespace(idx=1) %}
|
||||||
{% for authors in books['author'] %}
|
{% for authors in books['bals'] %}
|
||||||
$('#author-rem-{{cnt.idx}}').hover(
|
$('#author-rem-{{cnt.idx}}').hover(
|
||||||
function() { $('#author-{{cnt.idx}}').prop( 'style', 'color:red' ) },
|
function() {
|
||||||
function() { $('#author-{{cnt.idx}}').prop( 'style', '' ) } )
|
$('#author-{{cnt.idx}}').prop( 'style', 'color:red' )
|
||||||
|
$('#author-edit-{{cnt.idx}}').prop( 'style', 'color:red' )
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
$('#author-{{cnt.idx}}').prop( 'style', '' )
|
||||||
|
$('#author-edit-{{cnt.idx}}').prop( 'style', '' )
|
||||||
|
}
|
||||||
|
)
|
||||||
|
$('#author-edit-{{cnt.idx}}').hover(
|
||||||
|
function() { $('#author-{{cnt.idx}}').prop( 'style', 'color:blue' ) },
|
||||||
|
function() { $('#author-{{cnt.idx}}').prop( 'style', '' ) }
|
||||||
|
)
|
||||||
{% set cnt.idx = cnt.idx+1 %}
|
{% set cnt.idx = cnt.idx+1 %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
$('#owned').click( function() { if( $("#owned option:selected").text() == 'On Wish List' ) { $('#covertype').val( $('#covertype option:last').val() ); $('#condition').val( $('#condition option:last').val() ); $('#year_published').val(''); $('#rating').val( $('#rating option:last').val() ) } } )
|
$('#owned').click( function() { if( $("#owned option:selected").text() == 'On Wish List' ) { $('#covertype').val( $('#covertype option:last').val() ); $('#condition').val( $('#condition option:last').val() ); $('#year_published').val(''); $('#rating').val( $('#rating option:last').val() ) } } )
|
||||||
} )
|
} )
|
||||||
</script>
|
</script>
|
||||||
{% endblock script_content %}
|
{% endblock script_content %}
|
||||||
{% endif %}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user