delete & restore files now clean up UI and dont reload page by default. For all moves/deletes/restores that start on a search view, they now reload the page instead of just cleaning up the UI as searching by name will cause the UI to need complex redrawing, easier to live with the reload for now
This commit is contained in:
@@ -74,18 +74,18 @@ function GetExistingDirsAsDiv( dt, divname, ptype )
|
||||
} )
|
||||
}
|
||||
|
||||
// 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()
|
||||
// wrapper to do some clean up before POST to /move_files or /delete_files
|
||||
// used to remove the highlighted item(s) && reset the numbering so highlighting continues to work
|
||||
function MoveOrDelCleanUpUI()
|
||||
{
|
||||
// remove the images being moved (so UI immediately 'sees' the move)
|
||||
$("[name^=eid-]").each( function() { $('#'+$(this).attr('value')).remove() } )
|
||||
// reorder the images via ecnt again, so future highlighting can work
|
||||
document.mf_id=0; $('.figure').each( function() { $(this).attr('ecnt', document.mf_id ); document.mf_id++ } )
|
||||
$('#dbox').modal('hide')
|
||||
$.ajax({ type: 'POST', data: $('#mv_fm').serialize(), url: '/move_files', success: function(data) { CheckForJobs() } })
|
||||
}
|
||||
|
||||
|
||||
// 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)
|
||||
@@ -126,10 +126,12 @@ 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="MoveSubmit(); return false;" class="btn btn-outline-primary col-2">Ok</button>
|
||||
<button id="move_submit" onClick="MoveOrDelCleanUpUI(); $.ajax({ type: 'POST', data: $('#mv_fm').serialize(), url: '/move_files', success: function(data) {
|
||||
if( $(location).attr('pathname').match('search') !== null ) { window.location='/' }; CheckForJobs() } }); return false" class="btn btn-outline-primary col-2">Ok</button>
|
||||
</div>
|
||||
</form>
|
||||
`
|
||||
|
||||
$('#dbox-content').html(div)
|
||||
$('#dbox').modal('show')
|
||||
$("#prefix").keypress(function (e) { if (e.which == 13) { $("#move_submit").click(); return false; } } )
|
||||
@@ -148,18 +150,22 @@ function DelDBox(del_or_undel)
|
||||
<button onClick="$('#dbox').modal('hide')" class="btn btn-outline-secondary col-2">Cancel</button>
|
||||
`
|
||||
div+=`
|
||||
<button onClick="$('#dbox').modal('hide'); $.ajax({ type: 'POST', data: to_del, url:
|
||||
<button onClick="MoveOrDelCleanUpUI(); $.ajax({ type: 'POST', data: to_del, url:
|
||||
`
|
||||
if( del_or_undel == "Delete" )
|
||||
div+=`
|
||||
'/delete_files',
|
||||
success: function(data){ window.location='/'; CheckForJobs() } })" class="btn btn-outline-danger col-2">Ok</button>
|
||||
success: function(data){
|
||||
if( $(location).attr('pathname').match('search') !== null ) { window.location='/' }; CheckForJobs() } }); return false" class="btn btn-outline-danger col-2">Ok</button>
|
||||
</div>
|
||||
`
|
||||
else
|
||||
// just force page reload to / for now if restoring files from a search path -- a search (by name)
|
||||
// would match the deleted/restored file, so it would be complex to clean up the UI (and can't reload, as DB won't be changed yet)
|
||||
div+=`
|
||||
'/restore_files',
|
||||
success: function(data){ window.location='/'; CheckForJobs() } })" class="btn btn-outline-success col-2">Ok</button>
|
||||
success: function(data){
|
||||
if( $(location).attr('pathname').match('search') !== null ) { window.location='/' }; CheckForJobs() } }); return false" class="btn btn-outline-success col-2">Ok</button>
|
||||
</div>
|
||||
`
|
||||
$('#dbox-content').html(div)
|
||||
|
||||
Reference in New Issue
Block a user