33 lines
6.6 KiB
Cheetah
33 lines
6.6 KiB
Cheetah
{{define "title"}}{{if eqString .ContentKind "pinboard"}}{{if .EntryID}}Notiz bearbeiten{{else}}Neue Notiz{{end}}{{else}}{{if .EntryID}}Tagebucheintrag bearbeiten{{else}}Neuer Tagebucheintrag{{end}}{{end}}{{end}}
|
||
{{define "main"}}
|
||
{{$pinboard := eqString .ContentKind "pinboard"}}{{$path := "journal"}}{{if $pinboard}}{{$path = "pinboard"}}{{end}}{{$editable := canGarden .Garden "content:write"}}
|
||
<header class='page-heading'><div><span class='eyebrow'>{{if $pinboard}}Pinnwand{{else}}Gartentagebuch{{end}}</span><h2>{{if $pinboard}}{{if .EntryID}}Notiz bearbeiten{{else}}Neue Notiz{{end}}{{else}}{{if .EntryID}}Eintrag bearbeiten{{else}}Neuer Eintrag{{end}}{{end}}</h2></div></header>
|
||
{{$form := .Form}}
|
||
<form class='panel journal-form' method='POST' enctype='multipart/form-data' data-journal-editor data-entry-kind='{{.ContentKind}}'>
|
||
<input type='hidden' name='csrf_token' value='{{.CSRFToken}}'>
|
||
<label for='title'>Titel{{if $pinboard}} <span class='muted'>(optional)</span>{{end}}</label><input id='title' name='title' value='{{$form.Title}}' maxlength='500' {{if not $pinboard}}required{{end}}>{{with index $form.Errors "title"}}<p class='field-error'>{{.}}</p>{{end}}
|
||
{{if $pinboard}}<input type='hidden' name='date_time' value='{{$form.DateTime}}'>{{else}}<label for='date-time'>Datum und Uhrzeit</label><input id='date-time' type='datetime-local' name='date_time' value='{{$form.DateTime}}' required>{{with index $form.Errors "date_time"}}<p class='field-error'>{{.}}</p>{{end}}{{end}}
|
||
<label for='journal-body'>Text</label>
|
||
<div id='journal-editor'></div><textarea id='journal-body' name='body' rows='14' maxlength='100000' data-journal-body>{{$form.Body}}</textarea>{{with index $form.Errors "body"}}<p class='field-error'>{{.}}</p>{{end}}
|
||
<label for='keywords'>Tags</label><div class='tag-editor' data-tag-editor><div class='tag-bubbles' data-tag-bubbles></div><input id='keywords' name='keywords' value='{{$form.Keywords}}' placeholder='Tag eingeben …' autocomplete='off' data-tag-input><div class='tag-suggestions' data-tag-suggestions role='listbox' hidden>{{range $form.TagSuggestions}}<button type='button' data-tag-suggestion='{{.}}'>{{.}}</button>{{end}}</div></div><p class='muted'>Mit Enter oder Komma übernehmen. Bereits verwendete Tags werden vorgeschlagen.</p>
|
||
{{with $form.Attachments}}<fieldset><legend>Vorhandene Anhänge</legend><div class='attachment-checklist'>{{range .}}<div class='attachment-row'><a href='{{webPath (printf "%s.attachment" $path) $.Garden.ID $.EntryID .ID}}' download='{{.FileName}}'>{{.FileName}} ({{fileSize .Size}})</a><label class='attachment-remove' title='Anhang löschen'><input type='checkbox' name='remove_attachment' value='{{.ID}}'><span aria-hidden='true'>×</span><span class='sr-only'>{{.FileName}} löschen</span></label></div>{{end}}</div></fieldset>{{end}}
|
||
<fieldset class='journal-attachments'><legend>{{if $pinboard}}Fotos{{else}}Fotos, Videos und Audio{{end}}</legend>
|
||
<label class='button secondary file-picker'>{{if $pinboard}}Fotos auswählen{{else}}Mediendateien auswählen{{end}}<input type='file' name='attachments' accept='{{if $pinboard}}image/*{{else}}image/*,video/*,audio/*{{end}}' multiple data-journal-files></label>
|
||
{{template "journal_photo_editor"}}
|
||
{{if .Images}}<button type='button' class='secondary' data-open-dialog='journal-image-library'>Aus Bilderdatenbank</button>{{end}}
|
||
{{if not $pinboard}}<button type='button' class='secondary' data-video-record>Video aufnehmen</button>
|
||
<button type='button' class='secondary' data-audio-record>Audio aufnehmen</button>{{end}}
|
||
<input type='file' name='attachments' multiple hidden data-journal-generated-files>
|
||
<input type='file' name='embedded_images' accept='image/*' multiple hidden data-embedded-images>
|
||
<ul class='attachment-preview' data-attachment-preview></ul>
|
||
</fieldset>
|
||
{{if .Images}}<dialog id='journal-image-library' class='image-library-dialog'><h3>Bilder aus der Bilderdatenbank auswählen</h3><p class='muted'>Es können mehrere Bilder ausgewählt werden.</p><div class='image-picker-grid'>{{range .Images}}<label class='image-picker-item'><input type='checkbox' name='library_image_id' value='{{.ID}}' data-journal-library-image data-image-name='{{if .FileName}}{{.FileName}}{{else}}Bild vom {{.CreatedAt.Format "02.01.2006"}}{{end}}' data-image-size='{{.Size}}' {{if containsInt $form.LibraryImageIDs .ID}}checked{{end}}><img src='/g/{{$.Garden.ID}}/images/{{.ID}}/data' alt='{{if .FileName}}{{.FileName}}{{else}}Bild auswählen{{end}}' loading='lazy'><span>{{if .FileName}}{{.FileName}}{{else}}{{.CreatedAt.Format "02.01.2006"}}{{end}}</span></label>{{end}}</div><div class='image-actions'><button type='button' data-cancel-dialog>Auswahl übernehmen</button></div></dialog>{{end}}
|
||
<div class='actions'>{{if $editable}}<button>Speichern</button>{{end}}<a href='{{webPath (printf "garden.%s" $path) .Garden.ID}}'>{{if $editable}}Abbrechen{{else}}Zurück{{end}}</a></div>
|
||
</form>
|
||
{{if not $pinboard}}
|
||
<dialog class='camera-dialog' data-video-dialog><h3>Video aufnehmen</h3><video muted playsinline data-video-preview></video><p class='field-error' data-video-error aria-live='polite'></p><div class='image-actions'><button type='button' class='secondary' data-video-switch-camera>Kamera wechseln</button><button type='button' data-video-toggle>Aufnahme starten</button><button type='button' class='secondary' data-video-pause hidden>Pause</button><button type='button' data-video-apply hidden>Übernehmen</button><button type='button' class='secondary' data-video-cancel>Abbrechen</button></div></dialog>
|
||
<dialog class='camera-dialog' data-audio-dialog><h3>Audio aufnehmen</h3><div class='recording-indicator' data-audio-indicator data-recording-indicator hidden aria-label='Aufnahme läuft'><i></i><i></i><i></i><i></i><i></i></div><audio controls data-audio-preview hidden></audio><p class='muted' data-audio-status>Bereit zur Aufnahme.</p><p class='field-error' data-audio-error aria-live='polite'></p><div class='image-actions'><button type='button' data-audio-toggle>Aufnahme starten</button><button type='button' class='secondary' data-audio-pause hidden>Pause</button><button type='button' data-audio-apply hidden>Übernehmen</button><button type='button' class='secondary' data-audio-cancel>Abbrechen</button></div></dialog>
|
||
{{end}}
|
||
{{if and .EntryID $editable}}<form class='delete-form' method='POST' action='{{webPath (printf "%s.delete" $path) .Garden.ID .EntryID}}'><input type='hidden' name='csrf_token' value='{{.CSRFToken}}'><button class='danger'>{{if $pinboard}}Notiz löschen{{else}}Eintrag löschen{{end}}</button></form>{{end}}
|
||
{{end}}
|