camper/web/templates/public/campsite/calendar.gohtml

44 lines
1.7 KiB
Plaintext

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ $last := dec (len .Months)}}
{{ range $index, $month := .Months -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/season.Month */ -}}
<table class="month"
{{ if eq $index $last -}}
data-hx-get="/{{ currentLocale }}/campsites/calendar?year={{ .Year }}&amp;month={{ .Month | int }}"
data-hx-trigger="intersect once"
data-hx-swap="afterend"
{{- end }}
>
<caption>{{ pgettext .Name "month" }} {{ .Year }}</caption>
<thead>
<tr>
<th scope="col">{{(pgettext "Mon" "day" )}}</th>
<th scope="col">{{(pgettext "Tue" "day" )}}</th>
<th scope="col">{{(pgettext "Wed" "day" )}}</th>
<th scope="col">{{(pgettext "Thu" "day" )}}</th>
<th scope="col">{{(pgettext "Fri" "day" )}}</th>
<th scope="col">{{(pgettext "Sat" "day" )}}</th>
<th scope="col">{{(pgettext "Sun" "day" )}}</th>
</tr>
</thead>
<tbody>
{{ range .Weeks }}
<tr>
{{- range . }}
<td>
{{- if .Color -}}
<time style="--red: {{ slice .Color 1 3 | hexToDec }}; --green: {{ slice .Color 3 5 | hexToDec }}; --blue: {{ slice .Color 5 7 | hexToDec }}"
datetime="{{ .Date.Format "2006-01-02" }}"
>{{ .Date.Format "2" }}</time>
{{- end -}}
</td>
{{- end }}
</tr>
{{- end }}
</tbody>
</table>
{{- end }}