fixed BUG-114 -> only show path-specific existing options in movedbox. Added test doc to read to TODO
This commit is contained in:
@@ -35,12 +35,18 @@ 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') )
|
||||
seld_ptype=$('option:selected', '#rp_sel').attr('path_type')
|
||||
$('#move_path_type').val( seld_ptype )
|
||||
// clear all 'existing' buttons
|
||||
$('.move_Import').addClass('d-none')
|
||||
$('.move_Storage').addClass('d-none')
|
||||
// show just selected path's (relevant) buttons
|
||||
$('.move_'+seld_ptype).removeClass('d-none')
|
||||
}
|
||||
|
||||
// POST to see if there are any other existing directories named around this date
|
||||
// (if so display them as options for a move)
|
||||
function GetExistingDirsAsDiv( dt, divname )
|
||||
function GetExistingDirsAsDiv( dt, divname, ptype )
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST', data: null, url: '/getexistingpaths/'+dt,
|
||||
@@ -49,10 +55,17 @@ function GetExistingDirsAsDiv( dt, divname )
|
||||
dirs = JSON.parse(data)
|
||||
s=''
|
||||
dirs.forEach( function(item, index) {
|
||||
s+= '<button class="btn btn-outline-primary" type="button" onClick="$(\'#prefix\').val(\''+item.prefix+'\'); $(\'#suffix\').val(\''+item.suffix+'\');return false;">'+item.prefix+item.suffix+'</button>'
|
||||
if( item.ptype != ptype )
|
||||
vis = 'd-none '
|
||||
else
|
||||
vis = ''
|
||||
s+= '<button class="btn btn-outline-primary move_'+item.ptype+ ' ' + vis + '" '
|
||||
s+= 'onClick="$(\'#prefix\').val(\''+item.prefix+'\'); $(\'#suffix\').val(\''+item.suffix+'\');return false;">'+item.prefix+item.suffix+'</button>'
|
||||
} )
|
||||
if( s == '' )
|
||||
$('#existing').html('')
|
||||
else
|
||||
$('#move_'+ptype).removeClass('invisible')
|
||||
$('#'+divname).html(s)
|
||||
}
|
||||
} )
|
||||
@@ -86,8 +99,8 @@ function MoveDBox(path_details, db_url)
|
||||
div+=GetSelnAsDiv()
|
||||
yr=$('.highlight').first().attr('yr')
|
||||
dt=$('.highlight').first().attr('date')
|
||||
div+='<div id="existing" class="col-12">Use Existing:</div><div id="existing"></div>'
|
||||
GetExistingDirsAsDiv( dt, "existing" )
|
||||
div+='<div class="row">Use Existing Directory (in the chosen path):</div><div id="existing"></div>'
|
||||
GetExistingDirsAsDiv( dt, "existing", path_details[0].type )
|
||||
div+=`
|
||||
<div class="input-group my-3">
|
||||
<alert class="alert alert-primary my-auto py-1">
|
||||
|
||||
Reference in New Issue
Block a user