mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 02:25:30 +00:00
better loading states, BUGFIX: person edit link
This commit is contained in:
@@ -17,8 +17,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
URL_PERSON_EDIT = "edit"
|
URL_PERSON_EDIT = "edit"
|
||||||
TEMPLATE_PERSON_EDIT = "/person/edit/"
|
URL_PERSON_EDIT_SLASH = "edit/"
|
||||||
|
TEMPLATE_PERSON_EDIT = "/person/edit/"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -42,7 +43,9 @@ func (p *PersonEditPage) Setup(router *router.Router[*core.RequestEvent], ia pag
|
|||||||
rg := router.Group("/person/{id}/")
|
rg := router.Group("/person/{id}/")
|
||||||
rg.BindFunc(middleware.IsAdminOrEditor())
|
rg.BindFunc(middleware.IsAdminOrEditor())
|
||||||
rg.GET(URL_PERSON_EDIT, p.GET(engine, app))
|
rg.GET(URL_PERSON_EDIT, p.GET(engine, app))
|
||||||
|
rg.GET(URL_PERSON_EDIT_SLASH, p.GET(engine, app))
|
||||||
rg.POST(URL_PERSON_EDIT, p.POST(engine, app))
|
rg.POST(URL_PERSON_EDIT, p.POST(engine, app))
|
||||||
|
rg.POST(URL_PERSON_EDIT_SLASH, p.POST(engine, app))
|
||||||
rg.POST(URL_PERSON_EDIT+"/delete", p.POSTDelete(engine, app))
|
rg.POST(URL_PERSON_EDIT+"/delete", p.POSTDelete(engine, app))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -354,7 +357,7 @@ func (p *PersonEditPage) POST(engine *templating.Engine, app core.App) HandleFun
|
|||||||
return e.Redirect(http.StatusSeeOther, redirect)
|
return e.Redirect(http.StatusSeeOther, redirect)
|
||||||
}
|
}
|
||||||
setFlashSuccess(e, "Änderungen gespeichert.")
|
setFlashSuccess(e, "Änderungen gespeichert.")
|
||||||
redirect := fmt.Sprintf("/person/%s/edit", id)
|
redirect := fmt.Sprintf("/person/%s/edit/", id)
|
||||||
return e.Redirect(http.StatusSeeOther, redirect)
|
return e.Redirect(http.StatusSeeOther, redirect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8914,7 +8914,7 @@ class rc extends HTMLElement {
|
|||||||
<div class="px-3 py-1.5 text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
<div class="px-3 py-1.5 text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
||||||
Person
|
Person
|
||||||
</div>
|
</div>
|
||||||
<a href="/person/${h}/edit" class="flex items-center px-4 py-2 hover:bg-gray-100 transition-colors no-underline text-sm">
|
<a href="/person/${h}/edit/" class="flex items-center px-4 py-2 hover:bg-gray-100 transition-colors no-underline text-sm">
|
||||||
<i class="ri-edit-line text-base text-gray-700 mr-2.5"></i>
|
<i class="ri-edit-line text-base text-gray-700 mr-2.5"></i>
|
||||||
<span class="text-gray-900">Bearbeiten</span>
|
<span class="text-gray-900">Bearbeiten</span>
|
||||||
</a>
|
</a>
|
||||||
@@ -10006,7 +10006,7 @@ function Kc() {
|
|||||||
return h || (h = document.createElement("div"), h.id = "global-notice", h.className = "global-notice hidden", h.setAttribute("role", "status"), h.setAttribute("aria-live", "polite"), h.setAttribute("aria-atomic", "true"), h.dataset.state = "", h.innerHTML = `
|
return h || (h = document.createElement("div"), h.id = "global-notice", h.className = "global-notice hidden", h.setAttribute("role", "status"), h.setAttribute("aria-live", "polite"), h.setAttribute("aria-atomic", "true"), h.dataset.state = "", h.innerHTML = `
|
||||||
<div class="global-notice-inner">
|
<div class="global-notice-inner">
|
||||||
<i class="ri-loader-4-line spinning" aria-hidden="true"></i>
|
<i class="ri-loader-4-line spinning" aria-hidden="true"></i>
|
||||||
<span data-role="global-notice-text">Laden…</span>
|
<span data-role="global-notice-text">Lädt</span>
|
||||||
</div>
|
</div>
|
||||||
`, document.body?.appendChild(h)), h;
|
`, document.body?.appendChild(h)), h;
|
||||||
};
|
};
|
||||||
@@ -10026,16 +10026,16 @@ function Kc() {
|
|||||||
n && (clearTimeout(n), n = null);
|
n && (clearTimeout(n), n = null);
|
||||||
};
|
};
|
||||||
document.addEventListener("htmx:beforeRequest", (h) => {
|
document.addEventListener("htmx:beforeRequest", (h) => {
|
||||||
i += 1, u(), l(!0), a("loading", "Laden..."), c(h.detail?.elt, !0);
|
i += 1, u(), l(!0), a("loading", "Lädt"), c(h.detail?.elt, !0);
|
||||||
}), document.addEventListener("htmx:afterRequest", (h) => {
|
}), document.addEventListener("htmx:afterRequest", (h) => {
|
||||||
c(h.detail?.elt, !1), i = Math.max(0, i - 1), i === 0 && (l(!1), t.dataset.state !== "error" && o());
|
c(h.detail?.elt, !1), i = Math.max(0, i - 1), i === 0 && (l(!1), t.dataset.state !== "error" && o());
|
||||||
}), document.addEventListener("htmx:responseError", () => {
|
}), document.addEventListener("htmx:responseError", () => {
|
||||||
l(!1), a("error", "Laden fehlgeschlagen."), u(), n = setTimeout(() => {
|
l(!1), a("error", "Laden fehlgeschlagen."), u(), n = setTimeout(() => {
|
||||||
i === 0 ? o() : a("loading", "Laden...");
|
i === 0 ? o() : a("loading", "Lädt");
|
||||||
}, 2e3);
|
}, 2e3);
|
||||||
}), document.addEventListener("htmx:sendError", () => {
|
}), document.addEventListener("htmx:sendError", () => {
|
||||||
l(!1), a("error", "Verbindung fehlgeschlagen."), u(), n = setTimeout(() => {
|
l(!1), a("error", "Verbindung fehlgeschlagen."), u(), n = setTimeout(() => {
|
||||||
i === 0 ? o() : a("loading", "Laden...");
|
i === 0 ? o() : a("loading", "Lädt");
|
||||||
}, 2e3);
|
}, 2e3);
|
||||||
}), document.addEventListener("htmx:afterSwap", () => {
|
}), document.addEventListener("htmx:afterSwap", () => {
|
||||||
t = s(), t && !e && (e = t.querySelector("[data-role='global-notice-text']"));
|
t = s(), t && !e && (e = t.querySelector("[data-role='global-notice-text']"));
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -7,6 +7,6 @@
|
|||||||
data-state="">
|
data-state="">
|
||||||
<div class="global-notice-inner">
|
<div class="global-notice-inner">
|
||||||
<i class="ri-loader-4-line spinning" aria-hidden="true"></i>
|
<i class="ri-loader-4-line spinning" aria-hidden="true"></i>
|
||||||
<span data-role="global-notice-text">Laden…</span>
|
<span data-role="global-notice-text">Lädt</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -108,7 +108,7 @@
|
|||||||
class="w-full dbform form-with-action-bar"
|
class="w-full dbform form-with-action-bar"
|
||||||
id="changepersonform"
|
id="changepersonform"
|
||||||
method="POST"
|
method="POST"
|
||||||
action="{{ if $model.is_new }}/personen/new/{{ else }}/person/{{ $agent.Id }}/edit{{ end }}"
|
action="{{ if $model.is_new }}/personen/new/{{ else }}/person/{{ $agent.Id }}/edit/{{ end }}"
|
||||||
{{- if not $model.is_new -}}
|
{{- if not $model.is_new -}}
|
||||||
data-delete-endpoint="/person/{{ $agent.Id }}/edit/delete"
|
data-delete-endpoint="/person/{{ $agent.Id }}/edit/delete"
|
||||||
{{- end -}}>
|
{{- end -}}>
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ export class FabMenu extends HTMLElement {
|
|||||||
<div class="px-3 py-1.5 text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
<div class="px-3 py-1.5 text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
||||||
Person
|
Person
|
||||||
</div>
|
</div>
|
||||||
<a href="/person/${personId}/edit" class="flex items-center px-4 py-2 hover:bg-gray-100 transition-colors no-underline text-sm">
|
<a href="/person/${personId}/edit/" class="flex items-center px-4 py-2 hover:bg-gray-100 transition-colors no-underline text-sm">
|
||||||
<i class="ri-edit-line text-base text-gray-700 mr-2.5"></i>
|
<i class="ri-edit-line text-base text-gray-700 mr-2.5"></i>
|
||||||
<span class="text-gray-900">Bearbeiten</span>
|
<span class="text-gray-900">Bearbeiten</span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ function InitGlobalHtmxNotice() {
|
|||||||
noticeEl.innerHTML = `
|
noticeEl.innerHTML = `
|
||||||
<div class="global-notice-inner">
|
<div class="global-notice-inner">
|
||||||
<i class="ri-loader-4-line spinning" aria-hidden="true"></i>
|
<i class="ri-loader-4-line spinning" aria-hidden="true"></i>
|
||||||
<span data-role="global-notice-text">Laden…</span>
|
<span data-role="global-notice-text">Lädt</span>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
document.body?.appendChild(noticeEl);
|
document.body?.appendChild(noticeEl);
|
||||||
@@ -437,7 +437,7 @@ function InitGlobalHtmxNotice() {
|
|||||||
pending += 1;
|
pending += 1;
|
||||||
clearErrorTimeout();
|
clearErrorTimeout();
|
||||||
setBodyBusy(true);
|
setBodyBusy(true);
|
||||||
showNotice("loading", "Laden...");
|
showNotice("loading", "Lädt");
|
||||||
markElementBusy(event.detail?.elt, true);
|
markElementBusy(event.detail?.elt, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -460,7 +460,7 @@ function InitGlobalHtmxNotice() {
|
|||||||
if (pending === 0) {
|
if (pending === 0) {
|
||||||
hideNotice();
|
hideNotice();
|
||||||
} else {
|
} else {
|
||||||
showNotice("loading", "Laden...");
|
showNotice("loading", "Lädt");
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
});
|
});
|
||||||
@@ -473,7 +473,7 @@ function InitGlobalHtmxNotice() {
|
|||||||
if (pending === 0) {
|
if (pending === 0) {
|
||||||
hideNotice();
|
hideNotice();
|
||||||
} else {
|
} else {
|
||||||
showNotice("loading", "Laden...");
|
showNotice("loading", "Lädt");
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -641,14 +641,16 @@
|
|||||||
@apply block;
|
@apply block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Overlay disabled for now.
|
||||||
html[data-htmx-busy="true"]::before {
|
html[data-htmx-busy="true"]::before {
|
||||||
content: "";
|
content: "";
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
background: rgba(15, 23, 42, 0.18);
|
background: rgba(15, 23, 42, 0.08);
|
||||||
z-index: 40;
|
z-index: 40;
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
[data-htmx-busy="true"]:not(html):not(body) {
|
[data-htmx-busy="true"]:not(html):not(body) {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user