2023-08-14 18:18:26 +00:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
{{ define "title" -}}
|
|
|
|
{{( pgettext "Campsites" "title" )}}
|
|
|
|
{{- end }}
|
|
|
|
|
2024-01-21 21:44:04 +00:00
|
|
|
{{ define "breadcrumb" -}}
|
|
|
|
{{- end }}
|
|
|
|
|
2023-08-14 18:18:26 +00:00
|
|
|
{{ define "content" -}}
|
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite.campsiteIndex*/ -}}
|
|
|
|
<a href="/admin/campsites/new">{{( pgettext "Add Campsite" "action" )}}</a>
|
|
|
|
<h2>{{( pgettext "Campsites" "title" )}}</h2>
|
2024-01-24 13:42:47 +00:00
|
|
|
<div id="campground_map">
|
|
|
|
{{ template "campground_map.svg" }}
|
|
|
|
</div>
|
2023-08-14 18:18:26 +00:00
|
|
|
{{ if .Campsites -}}
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th scope="col">{{( pgettext "Label" "header" )}}</th>
|
|
|
|
<th scope="col">{{( pgettext "Type" "header" )}}</th>
|
2024-01-26 21:27:54 +00:00
|
|
|
<th scope="col">{{( pgettext "Features" "header" )}}</th>
|
|
|
|
<th scope="col">{{( pgettext "Carousel" "header" )}}</th>
|
2023-08-14 18:18:26 +00:00
|
|
|
<th scope="col">{{( pgettext "Active" "campsite" )}}</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{{ range .Campsites -}}
|
|
|
|
<tr>
|
Add campsite map in SVG
I intend to use the same SVG file for customers and employees, so i had
to change Oriol’s design to add a class to layers that are supposed to
be only for customers, like trees. These are hidden in the admin area.
I understood that customers and employees have to click on a campsite to
select it, and then they can book or whatever they need to do to them.
Since customers and employees most certainly will need to have different
listeners on campsites, i decided to add the link with JavaScript. To
do so, i need a custom XML attribute with the campsite’s identifier.
Since i have seen that all campsites have a label, i changed the
“identifier” to the unique combination (company_id, label). The
company_id is there because different companies could have the same
label; i left the campsite_id primary key for foreign constraints.
In this case, as a test, i add an <a> element to the campsite with a
link to edit it; we’ll discuss with Oriol what exactly it needs to do.
However, the original design had the labels in a different layer, that
interfered with the link, as the numbers must be above the path and
the link must wrap the path in order to “inherit” its shape. I had no
other recourse than to move the labels in the same layer as the paths’.
2023-09-24 01:17:13 +00:00
|
|
|
<td><a href="/admin/campsites/{{ .Label }}">{{ .Label }}</a></td>
|
2023-08-14 18:18:26 +00:00
|
|
|
<td>{{ .Type }}</td>
|
2024-01-26 21:27:54 +00:00
|
|
|
<td>
|
|
|
|
<a href="/admin/campsites/{{ .Label }}/features">{{( pgettext "Edit Features" "action" )}}</a>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<a href="/admin/campsites/{{ .Label }}/slides">{{( pgettext "Edit Carousel" "action" )}}</a>
|
|
|
|
</td>
|
2023-08-14 18:18:26 +00:00
|
|
|
<td>{{ if .Active }}{{( gettext "Yes" )}}{{ else }}{{( gettext "No" )}}{{ end }}</td>
|
|
|
|
</tr>
|
|
|
|
{{- end }}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{{ else -}}
|
|
|
|
<p>{{( gettext "No campsites added yet." )}}</p>
|
|
|
|
{{- end }}
|
Add campsite map in SVG
I intend to use the same SVG file for customers and employees, so i had
to change Oriol’s design to add a class to layers that are supposed to
be only for customers, like trees. These are hidden in the admin area.
I understood that customers and employees have to click on a campsite to
select it, and then they can book or whatever they need to do to them.
Since customers and employees most certainly will need to have different
listeners on campsites, i decided to add the link with JavaScript. To
do so, i need a custom XML attribute with the campsite’s identifier.
Since i have seen that all campsites have a label, i changed the
“identifier” to the unique combination (company_id, label). The
company_id is there because different companies could have the same
label; i left the campsite_id primary key for foreign constraints.
In this case, as a test, i add an <a> element to the campsite with a
link to edit it; we’ll discuss with Oriol what exactly it needs to do.
However, the original design had the labels in a different layer, that
interfered with the link, as the numbers must be above the path and
the link must wrap the path in order to “inherit” its shape. I had no
other recourse than to move the labels in the same layer as the paths’.
2023-09-24 01:17:13 +00:00
|
|
|
|
|
|
|
<script type="module">
|
2024-01-24 13:42:47 +00:00
|
|
|
import {setupCampgroundMap} from "/static/camper.js?v=";
|
|
|
|
|
|
|
|
setupCampgroundMap(document.getElementById('campground_map'));
|
Add campsite map in SVG
I intend to use the same SVG file for customers and employees, so i had
to change Oriol’s design to add a class to layers that are supposed to
be only for customers, like trees. These are hidden in the admin area.
I understood that customers and employees have to click on a campsite to
select it, and then they can book or whatever they need to do to them.
Since customers and employees most certainly will need to have different
listeners on campsites, i decided to add the link with JavaScript. To
do so, i need a custom XML attribute with the campsite’s identifier.
Since i have seen that all campsites have a label, i changed the
“identifier” to the unique combination (company_id, label). The
company_id is there because different companies could have the same
label; i left the campsite_id primary key for foreign constraints.
In this case, as a test, i add an <a> element to the campsite with a
link to edit it; we’ll discuss with Oriol what exactly it needs to do.
However, the original design had the labels in a different layer, that
interfered with the link, as the numbers must be above the path and
the link must wrap the path in order to “inherit” its shape. I had no
other recourse than to move the labels in the same layer as the paths’.
2023-09-24 01:17:13 +00:00
|
|
|
</script>
|
2023-08-14 18:18:26 +00:00
|
|
|
{{- end }}
|