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:
2023-01-03 15:48:13 +11:00
parent 385a0ce17f
commit 972eac5b5b
3 changed files with 16 additions and 4 deletions

View File

@@ -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>
`