mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 02:25:30 +00:00
+a few improvements
This commit is contained in:
@@ -132,11 +132,23 @@
|
||||
<span data-role="contents-htmx-label">Eintrag wird geladen</span>
|
||||
</div>
|
||||
<input type="hidden" name="csrf_token" value="{{ $model.csrf_token }}" data-role="csrf-token" />
|
||||
<div class="flex items-center justify-end px-4">
|
||||
<div class="flex items-center justify-end gap-2 px-4">
|
||||
<button type="button" class="resetbutton w-auto px-3 py-2 flex items-center gap-2" data-role="contents-collapse-all" data-state="expanded">
|
||||
<i class="ri-arrow-up-s-line" data-role="contents-collapse-all-icon"></i>
|
||||
<span data-role="contents-collapse-all-label">Alle Eintraege einklappen</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="resetbutton w-auto px-3 py-2 flex items-center gap-2"
|
||||
data-loading-label="Eintrag wird geladen"
|
||||
hx-post="/almanach/{{ $model.result.Entry.MusenalmID }}/contents/insert"
|
||||
hx-target="[data-role='contents-list']"
|
||||
hx-swap="beforeend"
|
||||
hx-include="[data-role='csrf-token']"
|
||||
hx-vals='{"position":"after","content_id":""}'>
|
||||
<i class="ri-add-line"></i>
|
||||
<span>Eintrag anlegen</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1"
|
||||
data-role="contents-list"
|
||||
@@ -367,6 +379,14 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
const preserveScroll = (action) => {
|
||||
const top = window.scrollY;
|
||||
const left = window.scrollX;
|
||||
action();
|
||||
requestAnimationFrame(() => {
|
||||
window.scrollTo(left, top);
|
||||
});
|
||||
};
|
||||
|
||||
enterEditMode = (item) => {
|
||||
const view = item.querySelector("[data-role='content-view']");
|
||||
@@ -456,8 +476,10 @@
|
||||
if (item.classList.contains("data-editing") || item.dataset.contentTemp === "true") {
|
||||
return;
|
||||
}
|
||||
setCollapsed(item.dataset.collapsed !== "true");
|
||||
updateCollapseAllLabel();
|
||||
preserveScroll(() => {
|
||||
setCollapsed(item.dataset.collapsed !== "true");
|
||||
updateCollapseAllLabel();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -472,8 +494,10 @@
|
||||
if (event.target.closest("button, a, select, input, textarea")) {
|
||||
return;
|
||||
}
|
||||
setCollapsed(item.dataset.collapsed !== "true");
|
||||
updateCollapseAllLabel();
|
||||
preserveScroll(() => {
|
||||
setCollapsed(item.dataset.collapsed !== "true");
|
||||
updateCollapseAllLabel();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -37,13 +37,13 @@
|
||||
{{- if $content.MusenalmType -}}
|
||||
<span class="flex flex-wrap gap-1 text-gray-700 font-normal">
|
||||
{{- range $i, $t := $content.MusenalmType -}}
|
||||
<span class="bg-stone-100 px-1.5 py-0.5 rounded text-sm font-semibold">{{- $t -}}</span>
|
||||
<span class="bg-slate-200 text-slate-900 px-1.5 py-0.5 rounded text-sm font-semibold shadow-sm" data-role="content-type-pill">{{- $t -}}</span>
|
||||
{{- end -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
<div class="hidden flex flex-wrap items-baseline gap-2 text-gray-800" data-role="content-collapsed-summary">
|
||||
{{- if $content.Extent -}}
|
||||
<span class="text-sm font-semibold text-gray-700">S. {{- $content.Extent -}}</span>
|
||||
<span class="bg-slate-200 text-slate-900 px-1.5 py-0.5 rounded text-sm font-semibold shadow-sm">S. {{- $content.Extent -}}</span>
|
||||
{{- end -}}
|
||||
{{- if $content.PreferredTitle -}}
|
||||
<span class="text-sm font-semibold">{{- $content.PreferredTitle -}}</span>
|
||||
|
||||
Reference in New Issue
Block a user