fix BUG-64: can now move files into import or storage path

This commit is contained in:
2021-09-26 21:14:08 +10:00
parent 25a50d029f
commit 23c8d16a5b
7 changed files with 119 additions and 41 deletions

View File

@@ -29,9 +29,17 @@ function RunAIOnSeln(person)
$.ajax({ type: 'POST', data: post_data, url: '/run_ai_on', success: function(data){ window.location='/'; return false; } })
}
function change_rp_sel()
{
icon_url = $('option:selected', '#rp_sel').attr('icon_url')
$('#move_path_icon').html( '<svg id="move_path_icon" width="20" height="20" fill="currentColor"><use xlink:href="'
+ icon_url + '"></svg>' )
$('#move_path_type').val( $('option:selected', '#rp_sel').attr('path_type') )
}
// 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(sps, db_url)
function MoveDBox(path_details, db_url)
{
$('#dbox-title').html('Move Selected File(s) to new directory in Storage Path')
div =`
@@ -39,27 +47,23 @@ function MoveDBox(sps, db_url)
<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">
<input id="move_path_type" name="move_path_type" type="hidden"
`
div += ' value="' + path_details[0].type + '"></input>'
div+=GetSelnAsDiv()
yr=$('.highlight').first().attr('yr')
dt=$('.highlight').first().attr('date')
div+=`
<div class="input-group my-3">
<alert class="alert alert-primary my-auto py-1">
<svg width="20" height="20" fill="currentColor"><use xlink:href="
`
div+=db_url+'#db"/></svg>'
if( sps.length > 1 ) {
// NB: alert-primary here is a hack to get the bg the same color as the alert primary by
div+= '<select name="storage_rp" class="text-primary alert-primary py-1 border border-primary rounded">'
for(p of sps) {
div+= '<option>'+p+'</option>'
}
div+= '</select>'
} else {
div+= '/'+sps[0]+'/'
div+= '<input type="hidden" name="storage_rp" value="' + sps[0] + '">'
// NB: alert-primary here is a hack to get the bg the same color as the alert primary by
div+= '<svg id="move_path_icon" width="20" height="20" fill="currentColor"><use xlink:href="' + path_details[0].icon_url + '"></svg>'
div+= '<select id="rp_sel" name="rel_path" class="text-primary alert-primary py-1 border border-primary rounded" onChange="change_rp_sel()">'
for(p of path_details) {
div+= '<option path_type="'+p.type+'" icon_url="'+p.icon_url+'">'+p.path+'</option>'
}
div+= '</select>'
div+=`
</alert>
<input id="prefix" type="text" name="prefix" class="text-primary text-right form-control"