From 4333461b75a1f8268e116ae1f7459d6dfd3e32ab Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Wed, 15 Jun 2022 21:41:06 -0600 Subject: [PATCH] start moving file from its parent directory, cleanup some style/text --- archetype/fileManager.go | 21 ++++++++++++--------- static/style.css | 8 ++++++++ templates/file_actions.html | 1 + templates/file_move_process.html | 2 +- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/archetype/fileManager.go b/archetype/fileManager.go index 7a7d965..5fd5538 100644 --- a/archetype/fileManager.go +++ b/archetype/fileManager.go @@ -17,10 +17,11 @@ type SimpleFileManager struct { } type FileData struct { - Error string - Path string - Name string - IsDir bool + Error string + Path string + Name string + Parent string + IsDir bool } type FileListing struct { @@ -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,11 +122,12 @@ 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, - IsDir: fileInfo.IsDir(), + Path: filepath.Clean(slug), + Name: fileBase, + Parent: parent, + IsDir: fileInfo.IsDir(), } } diff --git a/static/style.css b/static/style.css index 3cbbd4a..059c864 100644 --- a/static/style.css +++ b/static/style.css @@ -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%; + } +} \ No newline at end of file diff --git a/templates/file_actions.html b/templates/file_actions.html index 5f418f8..097b375 100644 --- a/templates/file_actions.html +++ b/templates/file_actions.html @@ -19,6 +19,7 @@
/{{($file).Path}} +
Danger Zone diff --git a/templates/file_move_process.html b/templates/file_move_process.html index b8def9c..6b6ccba 100644 --- a/templates/file_move_process.html +++ b/templates/file_move_process.html @@ -15,7 +15,7 @@

File Move/Rename Success

-File moved from {{$slug}} to {{$dest}}{{$name}} +File moved from /{{$slug}} to {{$dest}}{{$name}} {{ end }}