From 528f47b68e0c7f5dc337cd16c1ff7c9db7ae9cd9 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sat, 1 Oct 2016 13:55:55 +0100 Subject: [PATCH] close #18; fix #30 bug but does not add the tooltip --- assets/embed/public/css/styles.css | 56 ++++++++++++++------------- assets/embed/public/js/application.js | 42 ++++++++++++-------- filemanager.go | 4 +- 3 files changed, 57 insertions(+), 45 deletions(-) diff --git a/assets/embed/public/css/styles.css b/assets/embed/public/css/styles.css index 47526ea5..7fe9d964 100644 --- a/assets/embed/public/css/styles.css +++ b/assets/embed/public/css/styles.css @@ -617,6 +617,7 @@ header div { -webkit-box-flex: 1; -ms-flex-positive: 1; flex-grow: 1; + position: relative; } #toolbar p, @@ -674,7 +675,7 @@ header .only-side { display: none; } -header #prev:hover + .prev-links, +header #prev:hover+.prev-links, header .prev-links:hover { display: flex; } @@ -685,6 +686,8 @@ header .prev-links:hover { header .prev-links { position: absolute; + top: 0; + left: 0; color: #7d7d7d; list-style: none; margin: 0; @@ -693,8 +696,9 @@ header .prev-links { box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); border-radius: .2em; flex-direction: column-reverse; - left: 1.5em; display: none; + transition: .2s ease all; + min-width: 12em; } header .prev-links a { @@ -705,13 +709,13 @@ header .prev-links a { header .prev-links a:first-child { border: 0; - border-bottom-right-radius: .5em; - border-bottom-left-radius: .5em; + border-bottom-right-radius: .2em; + border-bottom-left-radius: .2em; } header .prev-links a:last-child { - border-top-right-radius: .5em; - border-top-left-radius: .5em; + border-top-right-radius: .2em; + border-top-left-radius: .2em; } header .prev-links a:hover { @@ -1005,11 +1009,11 @@ i.spin { background-color: transparent; } -#editor fieldset> .action { +#editor fieldset>.action { opacity: 0; } -#editor fieldset:hover> .action { +#editor fieldset:hover>.action { opacity: 1; } @@ -1065,14 +1069,14 @@ i.spin { color: #fff; max-height: 4em; } - header> div:first-child #prev { + header>div:first-child #prev { display: none; } header #open-nav { display: inline-block; } /* SIDEBAR */ - header> div:nth-child(2) { + header>div:nth-child(2) { position: fixed; top: 0; z-index: 999999; @@ -1085,10 +1089,10 @@ i.spin { left: -100%; transition: .2s ease-in-out all; } - header> div:nth-child(2).active { + header>div:nth-child(2).active { left: 0; } - header> div:nth-child(2).active+ #overlay { + header>div:nth-child(2).active+#overlay { opacity: 1; visibility: visible; } @@ -1115,51 +1119,51 @@ i.spin { padding: .5em; margin: 0; } - header> div:nth-child(2)> div { + header>div:nth-child(2)>div { display: block; } - header> div:nth-child(2) .action { + header>div:nth-child(2) .action { border-radius: 0 !important; padding: .5em 0 !important; margin: 0 !important; text-align: left; background-color: transparent !important; } - header> div:nth-child(2) #prev { + header>div:nth-child(2) #prev { border-radius: 50% !important; padding: 0 !important; } - header> div:nth-child(2) #prev i { + header>div:nth-child(2) #prev i { color: #fff; } - header> div:nth-child(2) .action:hover { + header>div:nth-child(2) .action:hover { background-color: rgba(0, 0, 0, .1) !important; } - header> div:nth-child(2) .action:hover i { + header>div:nth-child(2) .action:hover i { background-color: transparent; } - header> div:nth-child(2) .action i { + header>div:nth-child(2) .action i { border-radius: 0; color: #6f6f6f; } - header> div:nth-child(2) .action span {} - header> div:nth-child(2) .action i, - header> div:nth-child(2) .action span { + header>div:nth-child(2) .action span {} + header>div:nth-child(2) .action i, + header>div:nth-child(2) .action span { vertical-align: middle; display: inline-block; } } @media screen and (max-width: 700px) { - header> div:first-child p a, - header> div:first-child p i { + header>div:first-child p a, + header>div:first-child p i { display: none !important; } - header> div:first-child p { + header>div:first-child p { font-size: 1em; } #editor .frontmatter { column-count: 1; column-gap: 0; } -} +} \ No newline at end of file diff --git a/assets/embed/public/js/application.js b/assets/embed/public/js/application.js index dd16e2de..fb79554d 100644 --- a/assets/embed/public/js/application.js +++ b/assets/embed/public/js/application.js @@ -198,13 +198,14 @@ var reloadListing = function(callback) { link.addEventListener('click', itemClickEvent); }); + updateToken(); + if (typeof callback == 'function') { callback(); } } } } - updateToken(); } // Rename file event @@ -383,15 +384,29 @@ var handleViewType = function(viewList) { if (viewList == "true") { listing.classList.add('list'); - button.innerHTML = 'view_module Switch view'; + button.innerHTML = 'view_module Switch view'; return false; } - button.innerHTML = 'view_list Switch view'; + button.innerHTML = 'view_list Switch view'; listing.classList.remove('list'); return false; } +var addNewDirEvents = function() { + document.getElementById('new').addEventListener('click', event => { + let newdir = document.getElementById('newdir'); + newdir.classList.add('enabled'); + newdir.focus(); + }); + + document.getElementById('newdir').addEventListener('blur', event => { + document.getElementById('newdir').classList.remove('enabled'); + }); + + document.getElementById('newdir').addEventListener('keydown', newDirEvent); +} + // Handles the new directory event var newDirEvent = function(event) { if (event.keyCode == 27) { @@ -414,11 +429,14 @@ var newDirEvent = function(event) { request.onreadystatechange = function() { if (request.readyState == 4) { button.changeToDone((request.status != 200), html); - reloadListing(); + reloadListing(() => { + addNewDirEvents(); + }); } } - } + + return false; } // Handles the event when there is change on selected elements @@ -550,17 +568,7 @@ document.addEventListener('listing', event => { document.getElementById("upload-input").click(); }); - document.getElementById('new').addEventListener('click', event => { - let newdir = document.getElementById('newdir'); - newdir.classList.add('enabled'); - newdir.focus(); - }); - - document.getElementById('newdir').addEventListener('blur', event => { - document.getElementById('newdir').classList.remove('enabled'); - }); - - document.getElementById('newdir').addEventListener('keydown', newDirEvent); + addNewDirEvents(); // Drag and Drop let items = document.getElementsByClassName('item'); @@ -892,4 +900,4 @@ document.addEventListener("DOMContentLoaded", function(event) { } return false; -}); +}); \ No newline at end of file diff --git a/filemanager.go b/filemanager.go index b63fb32a..bca9079c 100644 --- a/filemanager.go +++ b/filemanager.go @@ -242,9 +242,9 @@ func newDirectory(w http.ResponseWriter, r *http.Request, c *config.Config) (int var err error if extension == "" { - err = os.MkdirAll(path, 0755) + err = os.MkdirAll(path, 0775) } else { - err = ioutil.WriteFile(path, []byte(""), 0755) + err = ioutil.WriteFile(path, []byte(""), 0775) } if err != nil {