Move admin-only links inside the user’s menu

We discussed with Oriol how to show these “extra” menu items, as they
can’t be in the horizontal menu we have intended for employees, because
there is not enough horizontal space.

Oriol suggested to move these into the user menu.  In fact, the company
settings was already there, which means that i already wanted to do that
from the very beginning, i believe, but i must have forgotten it along
the way….  Or maybe it was because this is where Numerus has the company
settings menu item, too, and i did not see the relation with the rest;
i do not know.
This commit is contained in:
jordi fita mas 2023-09-25 13:13:19 +02:00
parent 819c0412d2
commit 5697ad27fe
17 changed files with 18 additions and 44 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,6 @@
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.typeL10nForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.typeL10nForm*/ -}}
{{ template "settings-tabs" "campsiteTypes" }}
<form data-hx-put="/admin/campsites/types/{{ .Slug }}/{{ .Locale.Language }}"> <form data-hx-put="/admin/campsites/types/{{ .Slug }}/{{ .Locale.Language }}">
<h2> <h2>
{{printf (pgettext "Translate Campsite Type to %s" "title") .Locale.Endonym }} {{printf (pgettext "Translate Campsite Type to %s" "title") .Locale.Endonym }}

View File

@ -13,7 +13,6 @@
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/carousel.slideForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/carousel.slideForm*/ -}}
{{ template "settings-tabs" .CarouselName }}
<form <form
{{ if .ID }} {{ if .ID }}
data-hx-put="/admin/{{ .CarouselName }}/slides/{{ .ID }}" data-hx-put="/admin/{{ .CarouselName }}/slides/{{ .ID }}"

View File

@ -9,7 +9,6 @@
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/home.slideL10nForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/home.slideL10nForm*/ -}}
{{ template "settings-tabs" "campsiteTypes" }}
<form data-hx-put="/admin/home/slides/{{ .ID }}/{{ .Locale.Language }}"> <form data-hx-put="/admin/home/slides/{{ .ID }}/{{ .Locale.Language }}">
<h2> <h2>
{{printf (pgettext "Translate Carousel Slide to %s" "title") .Locale.Endonym }} {{printf (pgettext "Translate Carousel Slide to %s" "title") .Locale.Endonym }}

View File

@ -8,7 +8,6 @@
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/home.homeIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/home.homeIndex*/ -}}
{{ template "settings-tabs" "home" }}
<h2>{{( pgettext "Carousel" "title" )}}</h2> <h2>{{( pgettext "Carousel" "title" )}}</h2>
<a href="/admin/home/slides/new">{{( pgettext "Add slide" "action" )}}</a> <a href="/admin/home/slides/new">{{( pgettext "Add slide" "action" )}}</a>
{{ if .Slides -}} {{ if .Slides -}}

View File

@ -4,4 +4,3 @@
--> -->
<title>{{ template "title" . }} — Camper</title> <title>{{ template "title" . }} — Camper</title>
{{ template "content" . }} {{ template "content" . }}
{{ define "settings-tabs" }}{{ end }}

View File

@ -32,6 +32,24 @@
<li class="icon_company"> <li class="icon_company">
<a href="/admin/company">{{( pgettext "Company Settings" "title" )}}</a> <a href="/admin/company">{{( pgettext "Company Settings" "title" )}}</a>
</li> </li>
<li>
<a href="/admin/campsites/types">{{( pgettext "Campsite Types" "title" )}}</a>
</li>
<li>
<a href="/admin/campsites">{{( pgettext "Campsites" "title" )}}</a>
</li>
<li>
<a href="/admin/seasons">{{( pgettext "Seasons" "title" )}}</a>
</li>
<li>
<a href="/admin/media">{{( pgettext "Media" "title" )}}</a>
</li>
<li>
<a href="/admin/home">{{( pgettext "Home Page" "title" )}}</a>
</li>
<li>
<a href="/admin/services">{{( pgettext "Services Page" "title" )}}</a>
</li>
{{- end }} {{- end }}
<li class="icon_logout"> <li class="icon_logout">
<button data-hx-delete="/me/session" data-hx-headers='{ {{ CSRFHeader }} }' <button data-hx-delete="/me/session" data-hx-headers='{ {{ CSRFHeader }} }'
@ -59,31 +77,3 @@
</main> </main>
</body> </body>
</html> </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>
<li>
<a {{ if ne . "seasons"}}href="/admin/seasons"{{ end }}>{{( pgettext "Seasons" "title" )}}</a>
</li>
<li>
<a {{ if ne . "home"}}href="/admin/home"{{ end }}>{{( pgettext "Home Page" "title" )}}</a>
</li>
<li>
<a {{ if ne . "services"}}href="/admin/services"{{ end }}>{{( pgettext "Services Page" "title" )}}</a>
</li>
<li>
<a {{ if ne . "media"}}href="/admin/media"{{ end }}>{{( pgettext "Media" "title" )}}</a>
</li>
</ul>
</nav>
{{- end }}

View File

@ -8,7 +8,6 @@
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.mediaForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.mediaForm*/ -}}
{{ template "settings-tabs" "media" }}
<form id="upload" enctype="multipart/form-data" data-hx-put="/admin/media/{{ .ID }}"> <form id="upload" enctype="multipart/form-data" data-hx-put="/admin/media/{{ .ID }}">
<h2>{{( pgettext "Edit Media" "title" )}}</h2> <h2>{{( pgettext "Edit Media" "title" )}}</h2>
<img src="{{ .Path }}" alt=""> <img src="{{ .Path }}" alt="">

View File

@ -8,7 +8,6 @@
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.mediaIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.mediaIndex*/ -}}
{{ template "settings-tabs" "media" }}
<h2>{{( pgettext "Media" "title" )}}</h2> <h2>{{( pgettext "Media" "title" )}}</h2>
<a href="/admin/media/upload">{{( pgettext "Upload media" "action" )}}</a> <a href="/admin/media/upload">{{( pgettext "Upload media" "action" )}}</a>
{{ if .Media -}} {{ if .Media -}}

View File

@ -8,7 +8,6 @@
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.uploadForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.uploadForm*/ -}}
{{ template "settings-tabs" "media" }}
<form id="mediaUpload" enctype="multipart/form-data" action="/admin/media" method="post" data-hx-boost="true"> <form id="mediaUpload" enctype="multipart/form-data" action="/admin/media" method="post" data-hx-boost="true">
<h2>{{( pgettext "Upload Media" "title" )}}</h2> <h2>{{( pgettext "Upload Media" "title" )}}</h2>
{{ CSRFInput }} {{ CSRFInput }}

View File

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

View File

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

View File

@ -8,7 +8,6 @@
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/services.servicesIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/services.servicesIndex*/ -}}
{{ template "settings-tabs" "services" }}
<h2>{{( pgettext "Carousel" "title" )}}</h2> <h2>{{( pgettext "Carousel" "title" )}}</h2>
<a href="/admin/services/slides/new">{{( pgettext "Add slide" "action" )}}</a> <a href="/admin/services/slides/new">{{( pgettext "Add slide" "action" )}}</a>
{{ if .Slides -}} {{ if .Slides -}}

View File

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