Re-Implemented Div-Menu

This commit is contained in:
Simon Martens
2025-06-04 19:52:52 +02:00
parent 715be79115
commit 3a6dcc0e3d
7 changed files with 413 additions and 640 deletions

View File

@@ -108,17 +108,6 @@ type AlmanachResult struct {
}
});
});
const closeButtons = document.querySelectorAll(".close-button");
closeButtons.forEach((el) => {
el.addEventListener("click", (ev) => {
ev.preventDefault();
const inputWrapper = el.closest(".inputwrapper");
if (inputWrapper) {
inputWrapper.classList.add("hidden");
}
});
});
</script>
<div class="container-normal mx-auto px-8 mt-4">
@@ -129,10 +118,13 @@ type AlmanachResult struct {
<div class="inputwrapper col-span-8">
<div class="flex flex-row justify-between">
<label for="preferred_title" class="inputlabel">Kurztitel<i class="ri-text"></i></label>
<label for="preferred_title" class="inputlabel"> Kurztitel <i class="ri-text"></i> </label>
<reset-button class="text-sm" controls="preferred_title" wrapper-class="inputwrapper" modified-class-suffix="modified"></reset-button>
</div>
<textarea name="preferred_title" id="preferred_title" class="inputinput no-enter" placeholder="" required autocomplete="off">{{ $model.result.Entry.PreferredTitle }}</textarea>
<textarea name="preferred_title" id="preferred_title" class="inputinput no-enter" placeholder="" required autocomplete="off">
{{- $model.result.Entry.PreferredTitle -}}
</textarea
>
</div>
<div class="col-span-4"></div>
@@ -140,60 +132,76 @@ type AlmanachResult struct {
<div class="col-span-4"></div>
<div-menu target-id="titles" class="col-span-2 col-start-7">
<button class="div-menu-button text-xs text-right w-full cursor-pointer"><i class="ri-add-line"></i> Titel hinzufügen</button>
<div-manager dm-target="titles" class="col-span-2 col-start-7">
<button class="dm-menu-button text-xs text-right w-full cursor-pointer"><i class="ri-add-line"></i> Titel hinzufügen</button>
<div class="inputwrapper {{ if eq $model.result.Entry.TitleStmt "" }}hidden{{ end }}" data-value="titel">
<div class="inputwrapper {{ if eq $model.result.Entry.TitleStmt "" }}hidden{{ end }}">
<div class="flex flex-row justify-between">
<label for="title" class="inputlabel menu-label">Titel <i class="ri-text"></i></label>
<label for="title" class="inputlabel menu-label"> Titel <i class="ri-text"></i> </label>
<div class="text-xs">
<reset-button controls="title" wrapper-class="inputwrapper" modified-class-suffix="modified" class="text-sm"></reset-button>
<button class="close-button text-sm cursor-pointer">
<reset-button class="text-sm" controls="title" wrapper-class="inputwrapper" modified-class-suffix="modified"></reset-button>
<button class="dm-close-button">
<i class="ri-close-line"></i>
</button>
</div>
</div>
<textarea name="title" id="title" class="inputinput" placeholder="" autocomplete="off" rows="2">{{ $model.result.Entry.TitleStmt }}</textarea>
<textarea name="title" id="title" class="inputinput" placeholder="" autocomplete="off" rows="2">
{{- $model.result.Entry.TitleStmt -}}
</textarea
>
</div>
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.SubtitleStmt "" }}hidden{{ end }}" data-value="subtitle">
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.SubtitleStmt "" }}hidden{{ end }}">
<div class="flex flex-row justify-between">
<label for="subtitle" class="inputlabel menu-label">Untertitel <i class="ri-text"></i></label>
<div>
<reset-button controls="subtitle" wrapper-class="inputwrapper" modified-class-suffix="modified" class="text-sm"></reset-button>
<button class="close-button text-sm cursor-pointer">
<label for="subtitle" class="inputlabel menu-label"> Untertitel <i class="ri-text"></i> </label>
<div class="text-xs">
<reset-button class="text-sm" controls="subtitle" wrapper-class="inputwrapper" modified-class-suffix="modified"></reset-button>
<button class="dm-close-button">
<i class="ri-close-line"></i>
</button>
</div>
</div>
<textarea name="subtitle" id="subtitle" class="inputinput" placeholder="" autocomplete="off" rows="2">{{ $model.result.Entry.SubtitleStmt }}</textarea>
<textarea name="subtitle" id="subtitle" class="inputinput" placeholder="" autocomplete="off" rows="2">
{{- $model.result.Entry.SubtitleStmt -}}
</textarea
>
</div>
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.VariantTitle "" }}hidden{{ end }}" data-value="varianttitle">
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.VariantTitle "" }}hidden{{ end }}">
<div class="flex flex-row justify-between">
<label for="varianttitle" class="inputlabel menu-label">Titelvarianten <i class="ri-text"></i></label>
<div>
<reset-button controls="varianttitle" wrapper-class="inputwrapper" modified-class-suffix="modified" class="text-sm"></reset-button>
<button class="close-button text-sm cursor-pointer">
<label for="varianttitle" class="inputlabel menu-label"> Titelvarianten <i class="ri-text"></i> </label>
<div class="text-xs">
<reset-button class="text-sm" controls="varianttitle" wrapper-class="inputwrapper" modified-class-suffix="modified"></reset-button>
<button class="dm-close-button">
<i class="ri-close-line"></i>
</button>
</div>
</div>
<textarea name="varianttitle" id="varianttitle" class="inputinput" placeholder="" autocomplete="off" rows="2">{{ $model.result.Entry.VariantTitle }}</textarea>
<textarea name="varianttitle" id="varianttitle" class="inputinput" placeholder="" autocomplete="off" rows="2">
{{- $model.result.Entry.VariantTitle -}}
</textarea
>
</div>
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.ParallelTitle "" }}hidden{{ end }}" data-value="paralleltitle">
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.ParallelTitle "" }}hidden{{ end }}">
<div class="flex flex-row justify-between">
<label for="paralleltitle" class="inputlabel menu-label">Übersetzter Titel <i class="ri-text"></i></label>
<div>
<reset-button controls="paralleltitle" wrapper-class="inputwrapper" modified-class-suffix="modified" class="text-sm"></reset-button>
<button class="close-button text-sm cursor-pointer">
<label for="paralleltitle" class="inputlabel menu-label"> Übersetzter Titel <i class="ri-text"></i> </label>
<div class="text-xs">
<reset-button class="text-sm" controls="paralleltitle" wrapper-class="inputwrapper" modified-class-suffix="modified"></reset-button>
<button class="dm-close-button">
<i class="ri-close-line"></i>
</button>
</div>
</div>
<textarea name="paralleltitle" id="paralleltitle" class="inputinput" placeholder="" autocomplete="off" rows="2">{{ $model.result.Entry.ParallelTitle }}</textarea>
<textarea name="paralleltitle" id="paralleltitle" class="inputinput" placeholder="" autocomplete="off" rows="2">
{{- $model.result.Entry.ParallelTitle -}}
</textarea
>
</div>
</div-menu>
</div-manager>
</form>
</div>