hopefully fix everything :)
parent
9f84c546a2
commit
5cb0900c38
|
@ -8,6 +8,7 @@ document.addEventListener('DOMContentLoaded', event => {
|
||||||
document.getElementById('logout').insertAdjacentHTML('beforebegin', `<a href="${link}">
|
document.getElementById('logout').insertAdjacentHTML('beforebegin', `<a href="${link}">
|
||||||
<div class="action">
|
<div class="action">
|
||||||
<i class="material-icons">settings</i>
|
<i class="material-icons">settings</i>
|
||||||
|
<span>Settings</span>
|
||||||
</div>
|
</div>
|
||||||
</a>`);
|
</a>`);
|
||||||
});
|
});
|
||||||
|
@ -56,6 +57,9 @@ document.addEventListener('listing', event => {
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('editor', event => {
|
document.addEventListener('editor', event => {
|
||||||
|
let container = document.getElementById('editor'),
|
||||||
|
kind = container.dataset.kind;
|
||||||
|
|
||||||
document.getElementById('submit').insertAdjacentHTML('afterend', `<div class="right">
|
document.getElementById('submit').insertAdjacentHTML('afterend', `<div class="right">
|
||||||
<button id="publish">
|
<button id="publish">
|
||||||
<span>
|
<span>
|
||||||
|
@ -73,6 +77,8 @@ document.addEventListener('editor', event => {
|
||||||
<span>Schedule</span>
|
<span>Schedule</span>
|
||||||
</button>`);
|
</button>`);
|
||||||
|
|
||||||
|
let button = document.querySelector('#schedule span:first-child');
|
||||||
|
|
||||||
document.getElementById('schedule').addEventListener('click', event => {
|
document.getElementById('schedule').addEventListener('click', event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
@ -81,20 +87,16 @@ document.addEventListener('editor', event => {
|
||||||
date = document.getElementById('publishDate').value;
|
date = document.getElementById('publishDate').value;
|
||||||
}
|
}
|
||||||
|
|
||||||
let container = document.getElementById('editor');
|
|
||||||
let kind = container.dataset.kind;
|
|
||||||
let button = document.querySelector('#schedule span:first-child');
|
|
||||||
|
|
||||||
let data = form2js(document.querySelector('form'));
|
let data = form2js(document.querySelector('form'));
|
||||||
let html = button.changeToLoading();
|
let html = button.changeToLoading();
|
||||||
let request = new XMLHttpRequest();
|
let request = new XMLHttpRequest();
|
||||||
request.open("PUT", window.location);
|
request.open("PUT", toWebDavURL(window.location.pathname));
|
||||||
request.setRequestHeader('Kind', kind);
|
request.setRequestHeader('Kind', kind);
|
||||||
request.setRequestHeader('Schedule', date);
|
request.setRequestHeader('Schedule', date);
|
||||||
request.send(JSON.stringify(data));
|
request.send(JSON.stringify(data));
|
||||||
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 && request.status != 201), html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -106,20 +108,19 @@ document.addEventListener('editor', event => {
|
||||||
if (document.getElementById('draft')) {
|
if (document.getElementById('draft')) {
|
||||||
document.getElementById('block-draft').remove();
|
document.getElementById('block-draft').remove();
|
||||||
}
|
}
|
||||||
let container = document.getElementById('editor');
|
|
||||||
let kind = container.dataset.kind;
|
|
||||||
let button = document.querySelector('#publish span:first-child');
|
|
||||||
|
|
||||||
let data = form2js(document.querySelector('form'));
|
let button = document.querySelector('#publish span:first-child'),
|
||||||
let html = button.changeToLoading();
|
data = form2js(document.querySelector('form')),
|
||||||
let request = new XMLHttpRequest();
|
html = button.changeToLoading(),
|
||||||
request.open("PUT", window.location);
|
request = new XMLHttpRequest();
|
||||||
|
|
||||||
|
request.open("PUT", toWebDavURL(window.location.pathname));
|
||||||
request.setRequestHeader('Kind', kind);
|
request.setRequestHeader('Kind', kind);
|
||||||
request.setRequestHeader('Regenerate', "true");
|
request.setRequestHeader('Regenerate', "true");
|
||||||
request.send(JSON.stringify(data));
|
request.send(JSON.stringify(data));
|
||||||
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 && request.status != 201), html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
2
hugo.go
2
hugo.go
|
@ -94,8 +94,6 @@ func (h Hugo) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if canBeEdited(r.URL.Path) && r.Method == http.MethodPut {
|
if canBeEdited(r.URL.Path) && r.Method == http.MethodPut {
|
||||||
r.URL.Path = strings.Replace(r.URL.Path, h.FileManager.Configs[0].BaseURL, h.FileManager.Configs[0].WebDavURL, -1)
|
|
||||||
|
|
||||||
code, err := h.FileManager.ServeHTTP(w, r)
|
code, err := h.FileManager.ServeHTTP(w, r)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue