move files now has bs toast pop for success and stays on the page you are on for more moves

This commit is contained in:
2023-01-03 22:46:29 +11:00
parent 972eac5b5b
commit 0eeb68658b
4 changed files with 12 additions and 5 deletions

3
TODO
View File

@@ -1,6 +1,5 @@
### GENERAL ### GENERAL
* after move, instead of back to home page, go to an ammended view of the thumbs to keep moving * get all status messages to use toasts AND get func to also increase/descrease the job counter as appropriate)
- 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) * ignore face should ignore ALL matching faces (re: Declan)

View File

@@ -622,8 +622,6 @@ def move_files():
for el in request.form: for el in request.form:
jex.append( JobExtra( name=f"{el}", value=request.form[el] ) ) jex.append( JobExtra( name=f"{el}", value=request.form[el] ) )
job=NewJob( "move_files", 0, None, jex ) job=NewJob( "move_files", 0, None, jex )
st.SetMessage( f"Created&nbsp;<a href=/job/{job.id}>Job #{job.id}</a>&nbsp;to move selected file(s)")
# return redirect("/jobs")
return make_response( jsonify( job_id=job.id, status="success" ) ) return make_response( jsonify( job_id=job.id, status="success" ) )
@login_required @login_required

View File

@@ -62,7 +62,7 @@ function MoveSubmit()
// remove the images being moved // remove the images being moved
$("[name^=eid-]").each( function() { $('#'+$(this).attr('value')).remove() } ) $("[name^=eid-]").each( function() { $('#'+$(this).attr('value')).remove() } )
$('#dbox').modal('hide') $('#dbox').modal('hide')
$.ajax({ type: 'POST', data: $('#mv_fm').serialize(), url: '/move_files', success: function(data){ console.log(data); return false; } }) $.ajax({ type: 'POST', data: $('#mv_fm').serialize(), url: '/move_files', success: function(data){ $('.toast-body').html( "Created&nbsp;<a class='link-light' href=/job/" + data.job_id + ">Job #" + data.job_id + "</a>&nbsp;to move selected file(s)" ); $('.toast').toast("show"); return false; } })
} }
// show the DBox for a move file, includes all thumbnails of selected files to move // show the DBox for a move file, includes all thumbnails of selected files to move

View File

@@ -168,6 +168,16 @@
{% if not InDBox %} {% if not InDBox %}
{%block script_content %}{% endblock script_content %} {%block script_content %}{% endblock script_content %}
<div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
<div id="status_toast" class="toast align-items-center text-white bg-success border-0" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body">
Hello, world! This is a toast message.
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
</body> </body>
</html> </html>
{% endif %} {% endif %}