mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 10:35: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>
|
<span data-role="contents-htmx-label">Eintrag wird geladen</span>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="csrf_token" value="{{ $model.csrf_token }}" data-role="csrf-token" />
|
<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">
|
<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>
|
<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>
|
<span data-role="contents-collapse-all-label">Alle Eintraege einklappen</span>
|
||||||
</button>
|
</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>
|
||||||
<div class="flex flex-col gap-1"
|
<div class="flex flex-col gap-1"
|
||||||
data-role="contents-list"
|
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) => {
|
enterEditMode = (item) => {
|
||||||
const view = item.querySelector("[data-role='content-view']");
|
const view = item.querySelector("[data-role='content-view']");
|
||||||
@@ -456,8 +476,10 @@
|
|||||||
if (item.classList.contains("data-editing") || item.dataset.contentTemp === "true") {
|
if (item.classList.contains("data-editing") || item.dataset.contentTemp === "true") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setCollapsed(item.dataset.collapsed !== "true");
|
preserveScroll(() => {
|
||||||
updateCollapseAllLabel();
|
setCollapsed(item.dataset.collapsed !== "true");
|
||||||
|
updateCollapseAllLabel();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,8 +494,10 @@
|
|||||||
if (event.target.closest("button, a, select, input, textarea")) {
|
if (event.target.closest("button, a, select, input, textarea")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setCollapsed(item.dataset.collapsed !== "true");
|
preserveScroll(() => {
|
||||||
updateCollapseAllLabel();
|
setCollapsed(item.dataset.collapsed !== "true");
|
||||||
|
updateCollapseAllLabel();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,13 +37,13 @@
|
|||||||
{{- if $content.MusenalmType -}}
|
{{- if $content.MusenalmType -}}
|
||||||
<span class="flex flex-wrap gap-1 text-gray-700 font-normal">
|
<span class="flex flex-wrap gap-1 text-gray-700 font-normal">
|
||||||
{{- range $i, $t := $content.MusenalmType -}}
|
{{- 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 -}}
|
{{- end -}}
|
||||||
</span>
|
</span>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
<div class="hidden flex flex-wrap items-baseline gap-2 text-gray-800" data-role="content-collapsed-summary">
|
<div class="hidden flex flex-wrap items-baseline gap-2 text-gray-800" data-role="content-collapsed-summary">
|
||||||
{{- if $content.Extent -}}
|
{{- 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 -}}
|
{{- end -}}
|
||||||
{{- if $content.PreferredTitle -}}
|
{{- if $content.PreferredTitle -}}
|
||||||
<span class="text-sm font-semibold">{{- $content.PreferredTitle -}}</span>
|
<span class="text-sm font-semibold">{{- $content.PreferredTitle -}}</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user