Files
Gardomatic/internal/web/templates/pages/journal.tmpl
T
kleiax 904d14b64c
CI / test (push) Canceled after 0s
Initial commit
2026-09-12 22:22:17 +02:00

18 lines
2.5 KiB
Cheetah

{{define "title"}}{{if eqString .ContentKind "pinboard"}}Pinnwand{{else}}Tagebuch{{end}}{{end}}
{{define "main"}}
{{$pinboard := eqString .ContentKind "pinboard"}}{{$path := "journal"}}{{if $pinboard}}{{$path = "pinboard"}}{{end}}
<header class='page-heading'><div><span class='eyebrow'>{{if $pinboard}}Ideen und Notizen{{else}}Gartentagebuch{{end}}</span><h2>{{if $pinboard}}Pinnwand{{else}}Tagebuch{{end}}</h2></div>{{if canGarden .Garden "content:write"}}<div class='actions'><a class='button' href='{{webPath (printf "%s.new" $path) .Garden.ID}}'>{{if $pinboard}}Notiz anlegen{{else}}Eintrag anlegen{{end}}</a></div>{{end}}</header>
{{$editable := canGarden .Garden "content:write"}}
<div class='journal-list{{if $pinboard}} pinboard-list{{end}}'>
{{range .JournalEntries}}
<article class='panel journal-entry{{if $editable}} card--clickable card--interactive{{end}}' id='entry-{{.ID}}' style='--author-color: {{.AuthorColor}}'{{if $editable}} role='link' tabindex='0' data-card-href='{{webPath (printf "%s.edit" $path) $.Garden.ID .ID}}' aria-label='{{if .Title}}{{.Title}}{{else}}Eintrag{{end}} bearbeiten'{{end}}>
<header><div>{{with .Title}}<h3>{{.}}</h3>{{end}}<p class='journal-meta'><time datetime='{{.CreatedAt.Format "2006-01-02T15:04:05Z07:00"}}'>{{journalDate .CreatedAt}}</time> · {{.AuthorName}}</p></div></header>
{{with .Tags}}<ul class='tag-list' aria-label='Schlagwörter'>{{range .}}<li>{{.}}</li>{{end}}</ul>{{end}}
<div class='markdown-body'>{{markdown .Body}}</div>
{{with .Attachments}}<div class='journal-media'>{{range .}}{{if hasPrefix .MediaType "image/"}}<figure><img src='/g/{{$.Garden.ID}}/{{$path}}/attachments/{{.EntryID}}/{{.ID}}' alt='{{.FileName}}' loading='lazy'><figcaption>{{.FileName}} · {{fileSize .Size}}</figcaption></figure>{{else if hasPrefix .MediaType "video/"}}<figure><video controls preload='metadata' src='/g/{{$.Garden.ID}}/{{$path}}/attachments/{{.EntryID}}/{{.ID}}'></video><figcaption>{{.FileName}} · {{fileSize .Size}}</figcaption></figure>{{else if hasPrefix .MediaType "audio/"}}<figure><audio controls preload='metadata' src='/g/{{$.Garden.ID}}/{{$path}}/attachments/{{.EntryID}}/{{.ID}}'></audio><figcaption>{{.FileName}} · {{fileSize .Size}}</figcaption></figure>{{end}}{{end}}</div>{{end}}
</article>
{{else}}<div class='panel'><p>{{if $pinboard}}Noch keine Notizen. Sammle hier spontane Ideen für deinen Garten.{{else}}Noch keine Tagebucheinträge. Halte fest, was in deinem Garten passiert.{{end}}</p></div>{{end}}
</div>
{{template "pagination" .}}
{{end}}