mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 10:35:30 +00:00
FIX: pages load with indexed map[string]any, page edit page
This commit is contained in:
43
views/routes/redaktion/seiten/body.gohtml
Normal file
43
views/routes/redaktion/seiten/body.gohtml
Normal file
@@ -0,0 +1,43 @@
|
||||
{{ $model := . }}
|
||||
|
||||
<div class="flex container-normal bg-slate-100 mx-auto px-8">
|
||||
<div class="flex flex-row w-full justify-between">
|
||||
<div class="flex flex-col justify-end-safe flex-2/5">
|
||||
<div class="mb-1">
|
||||
<i class="ri-pages-line"></i> Seiten
|
||||
</div>
|
||||
<h1 class="text-2xl w-full font-bold text-slate-900 mb-1">
|
||||
Seiteneditor
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col justify-end gap-y-4 pr-4">
|
||||
<div class="inputwrapper !mb-0">
|
||||
<div class="inputlabelrow">
|
||||
<label for="page-editor-select" class="inputlabel">Seite auswählen</label>
|
||||
</div>
|
||||
<select
|
||||
id="page-editor-select"
|
||||
name="key"
|
||||
class="inputinput"
|
||||
hx-get="/redaktion/seiten/form/"
|
||||
hx-trigger="change"
|
||||
hx-target="#page-editor-form"
|
||||
hx-swap="outerHTML"
|
||||
hx-indicator="body">
|
||||
{{- if $model.pages -}}
|
||||
{{- range $page := $model.pages -}}
|
||||
<option value="{{ $page.Key }}" {{ if eq $page.Key $model.selected_key }}selected{{ end }}>{{ $page.Title }}</option>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<option value="">Keine Seiten gefunden</option>
|
||||
{{- end -}}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-normal mx-auto mt-4 !px-0">
|
||||
{{ template "_page_form" $model }}
|
||||
</div>
|
||||
135
views/routes/redaktion/seiten/components/_page_form.gohtml
Normal file
135
views/routes/redaktion/seiten/components/_page_form.gohtml
Normal file
@@ -0,0 +1,135 @@
|
||||
{{ $model := . }}
|
||||
|
||||
<div id="page-editor-form">
|
||||
{{ template "_usermessage" $model }}
|
||||
|
||||
{{- if not $model.selected -}}
|
||||
<div class="text-gray-700 bg-slate-100 border border-slate-200 rounded-xs p-4">
|
||||
Keine Seite ausgewählt.
|
||||
</div>
|
||||
{{- else -}}
|
||||
<form
|
||||
class="w-full dbform"
|
||||
method="POST"
|
||||
action="/redaktion/seiten/save/"
|
||||
hx-boost="false">
|
||||
<input type="hidden" name="csrf_token" value="{{ $model.csrf_token }}" />
|
||||
<input type="hidden" name="page_key" value="{{ $model.selected.Key }}" />
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="inputwrapper">
|
||||
<div class="inputlabelrow">
|
||||
<label for="page-title" class="inputlabel">Titel</label>
|
||||
</div>
|
||||
<input type="text" id="page-title" name="title" class="inputinput" value="{{ $model.selected.Title }}" autocomplete="off" />
|
||||
</div>
|
||||
|
||||
<div class="inputwrapper">
|
||||
<div class="inputlabelrow">
|
||||
<label for="page-description" class="inputlabel">Beschreibung</label>
|
||||
</div>
|
||||
<textarea id="page-description" name="description" class="inputinput" rows="3" autocomplete="off">{{ $model.selected.Description }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="inputwrapper">
|
||||
<div class="inputlabelrow">
|
||||
<label for="page-keywords" class="inputlabel">Stichworte</label>
|
||||
</div>
|
||||
<input type="text" id="page-keywords" name="keywords" class="inputinput" value="{{ $model.selected.Keywords }}" autocomplete="off" />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2 text-lg font-bold text-gray-700 mt-4">
|
||||
<i class="ri-file-edit-line"></i>
|
||||
<span>Seiteninhalte</span>
|
||||
</div>
|
||||
|
||||
{{- if not $model.selected.Sections -}}
|
||||
<div class="text-gray-700 bg-slate-100 border border-slate-200 rounded-xs p-4">
|
||||
Keine HTML-Bereiche gefunden.
|
||||
</div>
|
||||
{{- else -}}
|
||||
{{- range $index, $section := $model.selected.Sections -}}
|
||||
<div class="inputwrapper">
|
||||
<div class="inputlabelrow">
|
||||
<div class="flex flex-col">
|
||||
<label for="page-html-{{ $index }}" class="inputlabel">{{ $section.Label }}</label>
|
||||
<span class="text-xs text-gray-500">{{ $section.Key }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<trix-toolbar id="page-html-toolbar-{{ $index }}">
|
||||
<div class="trix-toolbar-container">
|
||||
<span class="trix-toolbar-group">
|
||||
<button type="button" class="trix-toolbar-button" data-trix-attribute="bold" data-trix-key="b" title="Fett">
|
||||
<i class="ri-bold"></i>
|
||||
</button>
|
||||
<button type="button" class="trix-toolbar-button" data-trix-attribute="italic" data-trix-key="i" title="Kursiv">
|
||||
<i class="ri-italic"></i>
|
||||
</button>
|
||||
<button type="button" class="trix-toolbar-button" data-trix-attribute="strike" title="Gestrichen">
|
||||
<i class="ri-strikethrough"></i>
|
||||
</button>
|
||||
<button type="button" class="trix-toolbar-button" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="Link">
|
||||
<i class="ri-links-line"></i>
|
||||
</button>
|
||||
</span>
|
||||
|
||||
<span class="trix-toolbar-group">
|
||||
<button type="button" class="trix-toolbar-button" data-trix-attribute="heading1" title="Überschrift">
|
||||
<i class="ri-h-1"></i>
|
||||
</button>
|
||||
<button type="button" class="trix-toolbar-button" data-trix-attribute="quote" title="Zitat">
|
||||
<i class="ri-double-quotes-l"></i>
|
||||
</button>
|
||||
<button type="button" class="trix-toolbar-button" data-trix-attribute="bullet" title="Liste">
|
||||
<i class="ri-list-unordered"></i>
|
||||
</button>
|
||||
<button type="button" class="trix-toolbar-button" data-trix-attribute="number" title="Aufzählung">
|
||||
<i class="ri-list-ordered"></i>
|
||||
</button>
|
||||
<button type="button" class="trix-toolbar-button" data-trix-action="decreaseNestingLevel" title="Einzug verkleinern">
|
||||
<i class="ri-indent-decrease"></i>
|
||||
</button>
|
||||
<button type="button" class="trix-toolbar-button" data-trix-action="increaseNestingLevel" title="Einzug vergrößern">
|
||||
<i class="ri-indent-increase"></i>
|
||||
</button>
|
||||
</span>
|
||||
|
||||
<span class="trix-toolbar-group">
|
||||
<button type="button" class="trix-toolbar-button" data-trix-action="undo" data-trix-key="z" title="Rückgängig">
|
||||
<i class="ri-arrow-go-back-line"></i>
|
||||
</button>
|
||||
<button type="button" class="trix-toolbar-button" data-trix-action="redo" data-trix-key="shift+z" title="Wiederholen">
|
||||
<i class="ri-arrow-go-forward-line"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="trix-dialogs" data-trix-dialogs>
|
||||
<div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">
|
||||
<div class="trix-dialog__link-fields flex flex-row">
|
||||
<input type="url" name="href" class="trix-input trix-input--dialog" placeholder="URL eingeben…" aria-label="URL" required data-trix-input>
|
||||
<div class="trix-button-group flex-row">
|
||||
<input type="button" class="trix-button trix-button--dialog" value="Link" data-trix-method="setAttribute">
|
||||
<input type="button" class="trix-button trix-button--dialog" value="Unlink" data-trix-method="removeAttribute">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</trix-toolbar>
|
||||
|
||||
<textarea hidden id="page-html-{{ $index }}" name="html[{{ $section.Key }}]" autocomplete="off">{{- $section.HTML -}}</textarea>
|
||||
<trix-editor input="page-html-{{ $index }}" toolbar="page-html-toolbar-{{ $index }}"></trix-editor>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<div class="flex justify-end mt-6">
|
||||
<button type="submit" class="btn bg-slate-800 text-white px-4 py-2 rounded-xs hover:bg-slate-900">
|
||||
<i class="ri-save-line"></i> Speichern
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{{- end -}}
|
||||
</div>
|
||||
1
views/routes/redaktion/seiten/form/body.gohtml
Normal file
1
views/routes/redaktion/seiten/form/body.gohtml
Normal file
@@ -0,0 +1 @@
|
||||
{{ template "_page_form" . }}
|
||||
1
views/routes/redaktion/seiten/head.gohtml
Normal file
1
views/routes/redaktion/seiten/head.gohtml
Normal file
@@ -0,0 +1 @@
|
||||
<title>Seiteneditor</title>
|
||||
Reference in New Issue
Block a user