71 lines
1.7 KiB
HTML
71 lines
1.7 KiB
HTML
{{ define "item-buttons" -}}
|
|
<button
|
|
class="item-button"
|
|
title="Deactivate {{ .Source }}/{{ .Id }}"
|
|
hx-target="closest article"
|
|
hx-select="article"
|
|
hx-delete="/item/{{ .Source }}/{{ .Id }}"
|
|
>✕</button>
|
|
<button
|
|
class="item-button"
|
|
title="Punt {{ .Source }}/{{ .Id }}"
|
|
>↷</button>
|
|
{{- if .Link }}<a class="item-link" href="{{ .Link }}" target="_blank">⇗</a>
|
|
{{ end -}}
|
|
{{ range $key, $_ := .Action }}
|
|
<button
|
|
class="item-button"
|
|
title="{{ $key }}"
|
|
hx-target="closest article"
|
|
hx-select="article"
|
|
hx-disabled-elt="this"
|
|
hx-post="/item/{{ $.Source }}/{{ $.Id }}/action/{{ $key }}"
|
|
>{{ $key }}</button>
|
|
{{ end -}}
|
|
{{ end }}
|
|
|
|
{{ define "item-title" -}}
|
|
<span class="item-title">{{ or .Title .Id | raw }}</span>
|
|
{{- end }}
|
|
|
|
{{ define "item-class" -}}{{ if not .Active }}strikethru {{ end }}{{ if not .Active }}fade{{ end }}{{- end}}
|
|
|
|
{{ define "item" -}}
|
|
<article
|
|
id="{{ .Source }}-{{ .Id }}"
|
|
class="{{ template "item-class" . }}"
|
|
>
|
|
|
|
{{- /* The item title is a clickable <summary> if there is body content */ -}}
|
|
{{ if .Body }}
|
|
<details>
|
|
<summary>
|
|
{{ template "item-buttons" . }}
|
|
{{ template "item-title" . }}
|
|
</summary>
|
|
<p>{{ raw .Body }}</p>
|
|
</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" */ -}}
|