camper/web/templates/admin/services/index.gohtml

100 lines
4.1 KiB
Plaintext
Raw Normal View History

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
{{( pgettext "Services Page" "title" )}}
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/services.servicesIndex*/ -}}
<h2>{{( pgettext "Carousel" "title" )}}</h2>
<a href="/admin/services/slides/new">{{( pgettext "Add slide" "action" )}}</a>
{{ if .Slides -}}
<form id="slide-index"
class="sortable"
data-hx-post="/admin/services/slides/order"
data-hx-trigger="end"
data-hx-select="#slide-index"
data-hx-swap="outerHTML"
>
{{ CSRFInput }}
<table>
<thead>
<tr>
<th scope="col">{{( pgettext "Image" "header" )}}</th>
<th scope="col">{{( pgettext "Caption" "header" )}}</th>
<th scope="col">{{( pgettext "Actions" "header" )}}</th>
</tr>
</thead>
<tbody>
{{ $confirm := ( gettext "Are you sure you wish to delete this slide?" )}}
{{ range $slide := .Slides -}}
<tr>
<td>
<span class="handle"></span>
<input type="hidden" name="media_id" value="{{ .ID }}">
<a href="/admin/services/slides/{{ .ID }}"><img src="{{ .Media }}" alt=""></a>
</td>
<td><a href="/admin/services/slides/{{ .ID }}">{{ .Caption }}</a></td>
<td>
<form data-hx-delete="/admin/services/slides/{{ .ID }}"
data-hx-confirm="{{ $confirm }}"
data-hx-headers='{ {{ CSRFHeader }} }'>
<button type="submit">{{( pgettext "Delete" "action" )}}</button>
</form>
</td>
</tr>
{{- end }}
</tbody>
</table>
</form>
{{ else -}}
<p>{{( gettext "No slides added yet." )}}</p>
{{- end }}
<h2>{{( pgettext "Services" "title" )}}</h2>
2023-09-26 14:51:35 +00:00
<a href="/admin/services/new">{{( pgettext "Add service" "action" )}}</a>
{{ if .Services -}}
<form id="service-index"
class="sortable"
data-hx-post="/admin/services/order"
data-hx-trigger="end"
data-hx-select="#service-index"
data-hx-swap="outerHTML"
>
{{ CSRFInput }}
<table class="services">
<thead>
<tr>
<th scope="col" class="sr-only">{{( pgettext "Order" "header" )}}</th>
<th scope="col">{{( pgettext "Service" "header" )}}</th>
<th scope="col">{{( pgettext "Actions" "header" )}}</th>
</tr>
</thead>
<tbody>
{{ $confirm := ( gettext "Are you sure you wish to delete this service?" )}}
{{ range .Services -}}
<tr>
<td>
<input type="hidden" name="service_id" value="{{ .ID }}">
<span class="handle"></span>
</td>
<td class="icon_{{ .Icon }}"><a href="{{ .URL }}">{{ .Name }}</a></td>
<td>
<form data-hx-delete="{{ .URL }}"
data-hx-confirm="{{ $confirm }}"
data-hx-headers='{ {{ CSRFHeader }} }'>
<button type="submit">{{( pgettext "Delete" "action" )}}</button>
</form>
</td>
</tr>
{{- end }}
</tbody>
</table>
</form>
{{ else -}}
<p>{{( gettext "No services added yet." )}}</p>
{{- end }}
{{- end }}