first pass of move_files not redirecting to / and staying put for an other move_files, works, but needs success/toast
This commit is contained in:
1
TODO
1
TODO
@@ -1,5 +1,6 @@
|
||||
### GENERAL
|
||||
* after move, instead of back to home page, go to an ammended view of the thumbs to keep moving
|
||||
- works in DEV, should explore bootstrap5 toast? (or a better 'status' update on POSTs, and get it to also increase/descrease the job counter as appropriate)
|
||||
|
||||
* ignore face should ignore ALL matching faces (re: Declan)
|
||||
|
||||
|
||||
5
files.py
5
files.py
@@ -1,6 +1,6 @@
|
||||
from wtforms import SubmitField, StringField, HiddenField, validators, Form
|
||||
from flask_wtf import FlaskForm
|
||||
from flask import request, render_template, redirect, send_from_directory, url_for
|
||||
from flask import request, render_template, redirect, send_from_directory, url_for, jsonify, make_response
|
||||
from main import db, app, ma
|
||||
from sqlalchemy import Sequence
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
@@ -623,7 +623,8 @@ def move_files():
|
||||
jex.append( JobExtra( name=f"{el}", value=request.form[el] ) )
|
||||
job=NewJob( "move_files", 0, None, jex )
|
||||
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to move selected file(s)")
|
||||
return redirect("/jobs")
|
||||
# return redirect("/jobs")
|
||||
return make_response( jsonify( job_id=job.id, status="success" ) )
|
||||
|
||||
@login_required
|
||||
@app.route("/viewlist", methods=["POST"])
|
||||
|
||||
@@ -55,6 +55,16 @@ function GetExistingDirsAsDiv( dt, divname )
|
||||
} )
|
||||
}
|
||||
|
||||
// wrapper to do some clean up before POST to /move_files
|
||||
// used to remove the highlighted item(s) -- effectively removing them from view/selection so continued 'Moves' can occur
|
||||
function MoveSubmit()
|
||||
{
|
||||
// remove the images being moved
|
||||
$("[name^=eid-]").each( function() { $('#'+$(this).attr('value')).remove() } )
|
||||
$('#dbox').modal('hide')
|
||||
$.ajax({ type: 'POST', data: $('#mv_fm').serialize(), url: '/move_files', success: function(data){ console.log(data); return false; } })
|
||||
}
|
||||
|
||||
// show the DBox for a move file, includes all thumbnails of selected files to move
|
||||
// and a pre-populated folder to move them into, with text field to add a suffix
|
||||
function MoveDBox(path_details, db_url)
|
||||
@@ -64,7 +74,7 @@ function MoveDBox(path_details, db_url)
|
||||
<div class="form-row col-12">
|
||||
<p class="col">Moving the following files?</p>
|
||||
</div>
|
||||
<form id="mv_fm" class="form form-control-inline col-12" method="POST" action="/move_files">
|
||||
<form id="mv_fm" class="form form-control-inline col-12">
|
||||
<input id="move_path_type" name="move_path_type" type="hidden"
|
||||
`
|
||||
div += ' value="' + path_details[0].type + '"></input>'
|
||||
@@ -95,7 +105,7 @@ function MoveDBox(path_details, db_url)
|
||||
</div>
|
||||
<div class="form-row col-12 mt-2">
|
||||
<button onClick="$('#dbox').modal('hide'); return false;" class="btn btn-outline-secondary offset-1 col-2">Cancel</button>
|
||||
<button id="move_submit" onClick="$('#dbox').modal('hide'); $('#mv_fm').submit(); return false;" class="btn btn-outline-primary col-2">Ok</button>
|
||||
<button id="move_submit" onClick="MoveSubmit(); return false;" class="btn btn-outline-primary col-2">Ok</button>
|
||||
</div>
|
||||
</form>
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user