diff --git a/templates/webclient/files.html b/templates/webclient/files.html index 67dea949..0781b65c 100644 --- a/templates/webclient/files.html +++ b/templates/webclient/files.html @@ -124,6 +124,13 @@ +
+ + + + Setting a directory other than the current one will move the item there. This directory must exists + +
@@ -736,14 +743,23 @@ var itemType = getTypeFromMeta(selected); var itemName = getNameFromMeta(selected); var targetName = replaceSlash($("#rename_new_name").val()); + var targetDir = $("#rename_new_dir").val(); + if (targetDir != "/") { + targetDir = targetDir.endsWith('/') ? targetDir.slice(0, -1) : targetDir; + } + if (targetDir.trim() == ""){ + targetDir = "{{.CurrentDir}}"; + } else { + targetDir = encodeURIComponent(targetDir); + } var path; if (itemType == "1"){ path = '{{.DirsURL}}'; } else { path = '{{.FilesURL}}'; } - path+='?path={{.CurrentDir}}'+encodeURIComponent("/"+itemName)+'&target={{.CurrentDir}}'+encodeURIComponent("/"+targetName); - $('renameModal').modal('hide'); + path+='?path={{.CurrentDir}}'+encodeURIComponent("/"+itemName)+'&target='+targetDir+encodeURIComponent("/"+targetName); + $('#renameModal').modal('hide'); $.ajax({ url: path, type: 'PATCH', @@ -833,6 +849,7 @@ var selected = table.column(0).checkboxes.selected()[0]; var itemName = getNameFromMeta(selected); $("#rename_old_name").val(itemName); + $("#rename_new_dir").val(decodeURIComponent("{{.CurrentDir}}".replace(/\+/g, '%20'))); $("#rename_new_name").val(""); $('#renameModal').modal('show'); },