Add tabs to “company settings” pages to link each other

I realized that tax details, campsite types, and campsites pages are all
part of the settings of the company, in the sense that all of them are
set up by a company administrator, and should be under the same item in
the user menu.

The template for these tabs is in the same layout.gohtml file because
i did not want to repeat the tabs everywhere it were used, or i would
forget some of them when adding new tabs, and did not want to add a new
file just for that.
This commit is contained in:
jordi fita mas 2023-08-16 10:42:05 +02:00
parent 50fbfce9ee
commit 000a2e506e
6 changed files with 21 additions and 0 deletions

View File

@ -13,6 +13,7 @@
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite.campsiteForm*/ -}}
{{ template "settings-tabs" "campsites" }}
<form
{{ if .Slug }}
data-hx-put="/admin/campsites/{{ .Slug }}"

View File

@ -8,6 +8,7 @@
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite.campsiteIndex*/ -}}
{{ template "settings-tabs" "campsites" }}
<a href="/admin/campsites/new">{{( pgettext "Add Campsite" "action" )}}</a>
<h2>{{( pgettext "Campsites" "title" )}}</h2>
{{ if .Campsites -}}

View File

@ -13,6 +13,7 @@
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.typeForm*/ -}}
{{ template "settings-tabs" "campsiteTypes" }}
<form
{{ if .Slug }}
data-hx-put="/admin/campsites/types/{{ .Slug }}"

View File

@ -8,6 +8,7 @@
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.typeIndex*/ -}}
{{ template "settings-tabs" "campsiteTypes" }}
<a href="/admin/campsites/types/new">{{( pgettext "Add Type" "action" )}}</a>
<h2>{{( pgettext "Campsite Types" "title" )}}</h2>
{{ if .Types -}}

View File

@ -56,3 +56,19 @@
</main>
</body>
</html>
{{ define "settings-tabs" -}}
<nav>
<ul>
<li>
<a {{ if ne . "taxDetails" }}href="/admin/company"{{ end }}>{{( pgettext "Tax Details" "title" )}}</a>
</li>
<li>
<a {{ if ne . "campsiteTypes" }}href="/admin/campsites/types"{{ end }}>{{( pgettext "Campsite Types" "title" )}}</a>
</li>
<li>
<a {{ if ne . "campsites"}}href="/admin/campsites"{{ end }}>{{( pgettext "Campsites" "title" )}}</a>
</li>
</ul>
</nav>
{{- end }}

View File

@ -8,6 +8,7 @@
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/company.taxDetailsForm*/ -}}
{{ template "settings-tabs" "taxDetails" }}
<form data-hx-put="/admin/company">
<h2>{{( pgettext "Tax Details" "title" )}}</h2>
{{ CSRFInput }}