move buttons in books_for_series in series.html now are form buttons and submit and beginning of code to deal with it exists
This commit is contained in:
@@ -56,6 +56,9 @@ def series(id):
|
|||||||
### DDP: should this be request.form or request.values?
|
### DDP: should this be request.form or request.values?
|
||||||
alert="Success"
|
alert="Success"
|
||||||
series_form = SeriesForm(request.form)
|
series_form = SeriesForm(request.form)
|
||||||
|
if request.method == 'POST':
|
||||||
|
if 'move_button' in request.form:
|
||||||
|
print( 'maybe we are moving a book up or down in series, we pressed: ' + request.form['move_button'] )
|
||||||
if request.method == 'POST' and series_form.validate_on_submit():
|
if request.method == 'POST' and series_form.validate_on_submit():
|
||||||
id = request.form['id']
|
id = request.form['id']
|
||||||
series = Series.query.get(id)
|
series = Series.query.get(id)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
<form action="" method="POST">
|
||||||
<table id="book_table" class="table table-striped table-sm small" data-toolbar="#toolbar" data-search="true">
|
<table id="book_table" class="table table-striped table-sm small" data-toolbar="#toolbar" data-search="true">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="thead-light"><th>Title</th><th>Book Number</th></tr>
|
<tr class="thead-light"><th>Title</th><th>Book Number</th></tr>
|
||||||
@@ -6,12 +7,14 @@
|
|||||||
{% set last = namespace(val=0) %}
|
{% set last = namespace(val=0) %}
|
||||||
{% for book in books %}
|
{% for book in books %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td id="{{book.id}}">
|
||||||
{% if book.parent_ref|length %}
|
{% if book.parent_ref|length %}
|
||||||
{% set style="visibility: hidden" %}
|
{% set style="style=visibility:hidden" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a id="up-{{book.id}}" class="btn btn-outline-primary btn-small" style="{{style}}" href="#"><i class="fas fa-angle-double-up"></i></a>
|
<button type="submit" name="move_button" value="up-{{book.id}}" id="up-{{book.id}}" class="btn btn-outline-primary btn-small" {{style}}>
|
||||||
<a id="down-{{book.id}}" class="btn btn-outline-primary btn-small" style="{{style}}" href="#"><i class="fas fa-angle-double-down"></i></a>
|
<i class="fas fa-angle-double-up"></i></button>
|
||||||
|
<button type="submit" name="move_button" value="down-{{book.id}}" id="down-{{book.id}}" class="btn btn-outline-primary btn-small" {{style}}>
|
||||||
|
<i class="fas fa-angle-double-down"></i></button>
|
||||||
<a href="/book/{{book.id}}">{{book.title}}</a>
|
<a href="/book/{{book.id}}">{{book.title}}</a>
|
||||||
</td>
|
</td>
|
||||||
{% set num = SeriesBookNum( series.id, book.id ) %}
|
{% set num = SeriesBookNum( series.id, book.id ) %}
|
||||||
@@ -50,14 +53,15 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
|
</form>
|
||||||
<script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#book_table').DataTable( {
|
|
||||||
"paging": false, "searching": false, "info": false,
|
|
||||||
"order": [[1, 'asc']],
|
|
||||||
"columnDefs": [ { "type": "num", "targets": 1 } ] } );
|
|
||||||
} );
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
|
||||||
|
<script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#book_table').DataTable( {
|
||||||
|
"paging": false, "searching": false, "info": false,
|
||||||
|
"order": [[1, 'asc']],
|
||||||
|
"columnDefs": [ { "type": "num", "targets": 1 } ] } );
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user