start moving file from its parent directory, cleanup some style/text
This commit is contained in:
parent
87333f9d87
commit
4333461b75
4 changed files with 22 additions and 10 deletions
|
@ -20,6 +20,7 @@ type FileData struct {
|
|||
Error string
|
||||
Path string
|
||||
Name string
|
||||
Parent string
|
||||
IsDir bool
|
||||
}
|
||||
|
||||
|
@ -76,10 +77,11 @@ func (self *SimpleFileManager) ListSubTree(root string) FileListing {
|
|||
}
|
||||
|
||||
levels := strings.Split(root, "/")
|
||||
|
||||
if list.Root != "/" {
|
||||
list.Up = "/"
|
||||
}
|
||||
if len(levels) >= 2 {
|
||||
if len(levels) >= 2 && list.Root != "/" {
|
||||
list.Up = strings.Join(levels[:len(levels)-1], "/")
|
||||
if !strings.HasPrefix(list.Up, "/") {
|
||||
list.Up = "/" + list.Up
|
||||
|
@ -120,10 +122,11 @@ func (self *SimpleFileManager) GetFileData(slug string) FileData {
|
|||
|
||||
cleanedSlug := filepath.Clean(slug)
|
||||
fileBase := filepath.Base(cleanedSlug)
|
||||
|
||||
parent := strings.TrimSuffix("/"+cleanedSlug, "/"+fileBase)
|
||||
return FileData{
|
||||
Path: filepath.Clean(slug),
|
||||
Name: fileBase,
|
||||
Parent: parent,
|
||||
IsDir: fileInfo.IsDir(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ body {
|
|||
font-size: 200%;
|
||||
color: lightgray;
|
||||
padding: 0.2em;
|
||||
max-width: calc(100vw - 2em);
|
||||
}
|
||||
|
||||
.login form input[type="text"], .login form input[type="password"] {
|
||||
|
@ -117,6 +118,7 @@ nav {
|
|||
|
||||
nav ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
nav ul li {
|
||||
|
@ -363,3 +365,9 @@ input[type="file"]:valid + .file-feedback::after {
|
|||
.upload-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 512px) {
|
||||
body {
|
||||
font-size: 75%;
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
<div class="action-panel">
|
||||
<form class="file-move" method="GET" action="/file-move/{{($file).Path}}">
|
||||
<span>/{{($file).Path}}</span>
|
||||
<input hidden type="text" name="dest" value="{{($file).Parent}}"/>
|
||||
<input type="submit" value="Move/Rename"/>
|
||||
</form>
|
||||
<details class="danger-zone"><summary>Danger Zone</summary>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<h2>File Move/Rename Success</h2>
|
||||
|
||||
<span class="adapter-success">File moved from {{$slug}} to {{$dest}}{{$name}} </span>
|
||||
<span class="adapter-success">File moved from /{{$slug}} to {{$dest}}{{$name}} </span>
|
||||
|
||||
{{ end }}
|
||||
|
||||
|
|
Loading…
Reference in a new issue