close #18; fix #30 bug but does not add the tooltip

This commit is contained in:
Henrique Dias 2016-10-01 13:55:55 +01:00
parent 98192fdbf9
commit 528f47b68e
3 changed files with 57 additions and 45 deletions

View File

@ -617,6 +617,7 @@ header div {
-webkit-box-flex: 1; -webkit-box-flex: 1;
-ms-flex-positive: 1; -ms-flex-positive: 1;
flex-grow: 1; flex-grow: 1;
position: relative;
} }
#toolbar p, #toolbar p,
@ -674,7 +675,7 @@ header .only-side {
display: none; display: none;
} }
header #prev:hover + .prev-links, header #prev:hover+.prev-links,
header .prev-links:hover { header .prev-links:hover {
display: flex; display: flex;
} }
@ -685,6 +686,8 @@ header .prev-links:hover {
header .prev-links { header .prev-links {
position: absolute; position: absolute;
top: 0;
left: 0;
color: #7d7d7d; color: #7d7d7d;
list-style: none; list-style: none;
margin: 0; 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); 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; border-radius: .2em;
flex-direction: column-reverse; flex-direction: column-reverse;
left: 1.5em;
display: none; display: none;
transition: .2s ease all;
min-width: 12em;
} }
header .prev-links a { header .prev-links a {
@ -705,13 +709,13 @@ header .prev-links a {
header .prev-links a:first-child { header .prev-links a:first-child {
border: 0; border: 0;
border-bottom-right-radius: .5em; border-bottom-right-radius: .2em;
border-bottom-left-radius: .5em; border-bottom-left-radius: .2em;
} }
header .prev-links a:last-child { header .prev-links a:last-child {
border-top-right-radius: .5em; border-top-right-radius: .2em;
border-top-left-radius: .5em; border-top-left-radius: .2em;
} }
header .prev-links a:hover { header .prev-links a:hover {
@ -1005,11 +1009,11 @@ i.spin {
background-color: transparent; background-color: transparent;
} }
#editor fieldset> .action { #editor fieldset>.action {
opacity: 0; opacity: 0;
} }
#editor fieldset:hover> .action { #editor fieldset:hover>.action {
opacity: 1; opacity: 1;
} }
@ -1065,14 +1069,14 @@ i.spin {
color: #fff; color: #fff;
max-height: 4em; max-height: 4em;
} }
header> div:first-child #prev { header>div:first-child #prev {
display: none; display: none;
} }
header #open-nav { header #open-nav {
display: inline-block; display: inline-block;
} }
/* SIDEBAR */ /* SIDEBAR */
header> div:nth-child(2) { header>div:nth-child(2) {
position: fixed; position: fixed;
top: 0; top: 0;
z-index: 999999; z-index: 999999;
@ -1085,10 +1089,10 @@ i.spin {
left: -100%; left: -100%;
transition: .2s ease-in-out all; transition: .2s ease-in-out all;
} }
header> div:nth-child(2).active { header>div:nth-child(2).active {
left: 0; left: 0;
} }
header> div:nth-child(2).active+ #overlay { header>div:nth-child(2).active+#overlay {
opacity: 1; opacity: 1;
visibility: visible; visibility: visible;
} }
@ -1115,47 +1119,47 @@ i.spin {
padding: .5em; padding: .5em;
margin: 0; margin: 0;
} }
header> div:nth-child(2)> div { header>div:nth-child(2)>div {
display: block; display: block;
} }
header> div:nth-child(2) .action { header>div:nth-child(2) .action {
border-radius: 0 !important; border-radius: 0 !important;
padding: .5em 0 !important; padding: .5em 0 !important;
margin: 0 !important; margin: 0 !important;
text-align: left; text-align: left;
background-color: transparent !important; background-color: transparent !important;
} }
header> div:nth-child(2) #prev { header>div:nth-child(2) #prev {
border-radius: 50% !important; border-radius: 50% !important;
padding: 0 !important; padding: 0 !important;
} }
header> div:nth-child(2) #prev i { header>div:nth-child(2) #prev i {
color: #fff; color: #fff;
} }
header> div:nth-child(2) .action:hover { header>div:nth-child(2) .action:hover {
background-color: rgba(0, 0, 0, .1) !important; 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; background-color: transparent;
} }
header> div:nth-child(2) .action i { header>div:nth-child(2) .action i {
border-radius: 0; border-radius: 0;
color: #6f6f6f; color: #6f6f6f;
} }
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 i,
header> div:nth-child(2) .action span { header>div:nth-child(2) .action span {
vertical-align: middle; vertical-align: middle;
display: inline-block; display: inline-block;
} }
} }
@media screen and (max-width: 700px) { @media screen and (max-width: 700px) {
header> div:first-child p a, header>div:first-child p a,
header> div:first-child p i { header>div:first-child p i {
display: none !important; display: none !important;
} }
header> div:first-child p { header>div:first-child p {
font-size: 1em; font-size: 1em;
} }
#editor .frontmatter { #editor .frontmatter {

View File

@ -198,13 +198,14 @@ var reloadListing = function(callback) {
link.addEventListener('click', itemClickEvent); link.addEventListener('click', itemClickEvent);
}); });
updateToken();
if (typeof callback == 'function') { if (typeof callback == 'function') {
callback(); callback();
} }
} }
} }
} }
updateToken();
} }
// Rename file event // Rename file event
@ -383,15 +384,29 @@ var handleViewType = function(viewList) {
if (viewList == "true") { if (viewList == "true") {
listing.classList.add('list'); listing.classList.add('list');
button.innerHTML = '<i class="material-icons">view_module</i> <span>Switch view</span>'; button.innerHTML = '<i class="material-icons" title="Switch View">view_module</i> <span>Switch view</span>';
return false; return false;
} }
button.innerHTML = '<i class="material-icons">view_list</i> <span>Switch view</span>'; button.innerHTML = '<i class="material-icons" title="Switch View">view_list</i> <span>Switch view</span>';
listing.classList.remove('list'); listing.classList.remove('list');
return false; 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 // Handles the new directory event
var newDirEvent = function(event) { var newDirEvent = function(event) {
if (event.keyCode == 27) { if (event.keyCode == 27) {
@ -414,11 +429,14 @@ var newDirEvent = function(event) {
request.onreadystatechange = function() { request.onreadystatechange = function() {
if (request.readyState == 4) { if (request.readyState == 4) {
button.changeToDone((request.status != 200), html); button.changeToDone((request.status != 200), html);
reloadListing(); reloadListing(() => {
addNewDirEvents();
});
} }
} }
} }
return false;
} }
// Handles the event when there is change on selected elements // 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("upload-input").click();
}); });
document.getElementById('new').addEventListener('click', event => { addNewDirEvents();
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);
// Drag and Drop // Drag and Drop
let items = document.getElementsByClassName('item'); let items = document.getElementsByClassName('item');

View File

@ -242,9 +242,9 @@ func newDirectory(w http.ResponseWriter, r *http.Request, c *config.Config) (int
var err error var err error
if extension == "" { if extension == "" {
err = os.MkdirAll(path, 0755) err = os.MkdirAll(path, 0775)
} else { } else {
err = ioutil.WriteFile(path, []byte(""), 0755) err = ioutil.WriteFile(path, []byte(""), 0775)
} }
if err != nil { if err != nil {