add optional prefix to url
This commit is contained in:
@@ -10,11 +10,11 @@
|
||||
<h1 class="text-3xl font-bold text-white">{{.title}}</h1>
|
||||
<div class="flex items-center space-x-3">
|
||||
{{if .Authenticated}}
|
||||
<a href="/editor/edit/{{.note_path}}" class="btn-primary">
|
||||
<a href="{{url (print "/editor/edit/" .note_path)}}" class="btn-primary">
|
||||
<i class="fas fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
{{end}}
|
||||
<a href="/download/{{.note_path}}" class="btn-secondary">
|
||||
<a href="{{url (print "/download/" .note_path)}}" class="btn-secondary">
|
||||
<i class="fas fa-download mr-2"></i>Download
|
||||
</a>
|
||||
{{if .Authenticated}}
|
||||
@@ -28,7 +28,7 @@
|
||||
{{if .folder_path}}
|
||||
<p class="text-gray-400">
|
||||
<i class="fas fa-folder mr-2"></i>
|
||||
<a href="/folder/{{.folder_path}}" class="text-blue-400 hover:text-blue-300">{{.folder_path}}</a>
|
||||
<a href="{{url (print "/folder/" .folder_path)}}" class="text-blue-400 hover:text-blue-300">{{.folder_path}}</a>
|
||||
</p>
|
||||
{{end}}
|
||||
</div>
|
||||
@@ -79,13 +79,13 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const path = deleteBtn.dataset.path;
|
||||
const m = document.cookie.match(/(?:^|; )csrf_token=([^;]+)/);
|
||||
const csrf = m && m[1] ? decodeURIComponent(m[1]) : '';
|
||||
fetch(`/editor/delete/${path}`, {
|
||||
fetch(window.prefix(`/editor/delete/${path}`), {
|
||||
method: 'DELETE',
|
||||
headers: csrf ? { 'X-CSRF-Token': csrf } : {}
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
window.location.href = '/';
|
||||
window.location.href = window.prefix('/');
|
||||
} else {
|
||||
alert('Error deleting note');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user