intake/web/html/item.html
Tim Van Baak af77322755 Add link to item page
This will be useful later for editing items
2025-01-27 20:28:46 -08:00

49 lines
1.2 KiB
HTML

{{ define "item-buttons" -}}
<button class="item-button" title="Deactivate {{ .Source }}/{{ .Id }}">&#10005;</button>
<button class="item-button" title="Punt {{ .Source }}/{{ .Id }}">&#8631;</button>
{{- if .Link }}<a class="item-link" href="{{ .Link }}" target="_blank">&#8663;</a>
{{ end -}}
{{ end }}
{{ define "item-title" -}}
<span class="item-title">{{ or .Title .Id | raw }}</span>
{{- end }}
{{ define "item" -}}
<article id="{{ .Source }}-{{ .Id }}">
{{- /* The item title is a clickable <summary> if there is body content */ -}}
{{ if .Body }}
<details>
<summary>
{{ template "item-buttons" . }}
{{ template "item-title" . }}
</summary>
{{ if .Body }}
<p>{{ raw .Body }}</p>
{{ end }}
</details>
{{ template "item-buttons" . }}
{{- else -}}
{{ template "item-buttons" . }}
{{ template "item-title" . }}<br>
{{ end }}
{{- /* end if .Body */ -}}
{{- /* author/time footer line */ -}}
{{ if or .Author .Time }}
<span class="item-info">
{{ .Author }}
{{ .Time | tsToDate }}
</span><br>
{{ end -}}
{{- /* source/id/created footer line */ -}}
<span class="item-info">
<a href="/item/{{ .Source }}/{{ .Id }}">{{ .Source }}/{{ .Id }}</a>
{{ .Created | tsToDate }}
</span>
</article>
{{ end -}}
{{- /* end define "item" */ -}}