Add breadcrumb to all admin pages

I tried to use ../, and ../../ to make the routes relatives, but it
would not work well because the same page would have two URLs, one
ending with slash and another without, and the relative links would be
different on each case.
This commit is contained in:
jordi fita mas 2024-01-21 22:44:04 +01:00
parent 6ddc41e293
commit 26cc46c7b0
36 changed files with 1646 additions and 1399 deletions

964
po/ca.po

File diff suppressed because it is too large Load Diff

964
po/es.po

File diff suppressed because it is too large Load Diff

964
po/fr.po

File diff suppressed because it is too large Load Diff

View File

@ -237,7 +237,7 @@ body > header {
background-color: var(--camper--header--background-color); background-color: var(--camper--header--background-color);
} }
body > header, body > nav a { body > header, body > nav ul a {
padding: 0 3rem; padding: 0 3rem;
} }
@ -245,24 +245,37 @@ body > nav {
border-bottom: 1px solid var(--camper--color--light-gray); border-bottom: 1px solid var(--camper--color--light-gray);
} }
body > nav ul { body > nav ul, body > nav ol {
display: flex; display: flex;
list-style: none; list-style: none;
padding: 0; padding: 0;
} }
body > nav li { body > nav ul li {
flex: 1; flex: 1;
} }
body > nav a { body > nav a {
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
}
body > nav ul a {
min-height: 8rem; min-height: 8rem;
display: flex; display: flex;
align-items: center; align-items: center;
} }
body > .breadcrumb ol {
padding: .5em 3rem;
gap: .5em;
flex-wrap: wrap;
}
body > .breadcrumb li + li::before {
content: " > ";
}
body > footer { body > footer {
border-top: 1px solid var(--camper--color--light-gray); border-top: 1px solid var(--camper--color--light-gray);
padding: .25em 3rem; padding: .25em 3rem;

View File

@ -6,6 +6,9 @@
{{( pgettext "Bookings" "title" )}} {{( pgettext "Bookings" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/booking.bookingIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/booking.bookingIndex*/ -}}
<a href="/admin/bookings/new">{{( pgettext "Add Booking" "action" )}}</a> <a href="/admin/bookings/new">{{( pgettext "Add Booking" "action" )}}</a>

View File

@ -6,6 +6,9 @@
{{( pgettext "Payment Settings" "title" )}} {{( pgettext "Payment Settings" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/booking.paymentForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/booking.paymentForm*/ -}}
<form data-hx-put="/admin/booking/payment"> <form data-hx-put="/admin/booking/payment">

View File

@ -11,6 +11,13 @@
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.slideForm*/ -}}
<li><a href="/admin/campsites">{{( pgettext "Campsites" "title" )}}</a></li>
<li><a href="/admin/campsites/types">{{( pgettext "Campsite Types" "title" )}}</a></li>
<li><a href="/admin/campsites/types/{{ .TypeSlug }}/slides">{{( pgettext "Campsite Type Carousel" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.slideForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.slideForm*/ -}}
<form <form

View File

@ -6,6 +6,11 @@
{{( pgettext "Campsite Type Carousel" "title" )}} {{( pgettext "Campsite Type Carousel" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/campsites">{{( pgettext "Campsites" "title" )}}</a></li>
<li><a href="/admin/campsites/types">{{( pgettext "Campsite Types" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.carouselIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.carouselIndex*/ -}}
<h2>{{( pgettext "Campsite Type Carousel" "title" )}}</h2> <h2>{{( pgettext "Campsite Type Carousel" "title" )}}</h2>

View File

@ -11,6 +11,13 @@
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.featureForm*/ -}}
<li><a href="/admin/campsites">{{( pgettext "Campsites" "title" )}}</a></li>
<li><a href="/admin/campsites/types">{{( pgettext "Campsite Types" "title" )}}</a></li>
<li><a href="/admin/campsites/types/{{ .TypeSlug }}/features">{{( pgettext "Campsite Type Features" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.featureForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.featureForm*/ -}}
<form <form

View File

@ -6,6 +6,11 @@
{{( pgettext "Campsite Type Features" "title" )}} {{( pgettext "Campsite Type Features" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/campsites">{{( pgettext "Campsites" "title" )}}</a></li>
<li><a href="/admin/campsites/types">{{( pgettext "Campsite Types" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.featureIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.featureIndex*/ -}}
<a href="/admin/campsites/types/{{ .TypeSlug }}/features/new">{{( pgettext "Add Feature" "action" )}}</a> <a href="/admin/campsites/types/{{ .TypeSlug }}/features/new">{{( pgettext "Add Feature" "action" )}}</a>

View File

@ -11,6 +11,10 @@
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="./">{{( pgettext "Campsites" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite.campsiteForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite.campsiteForm*/ -}}
<form <form

View File

@ -6,6 +6,9 @@
{{( pgettext "Campsites" "title" )}} {{( pgettext "Campsites" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite.campsiteIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite.campsiteIndex*/ -}}
<a href="/admin/campsites/new">{{( pgettext "Add Campsite" "action" )}}</a> <a href="/admin/campsites/new">{{( pgettext "Add Campsite" "action" )}}</a>

View File

@ -11,6 +11,13 @@
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.optionForm*/ -}}
<li><a href="/admin/campsites">{{( pgettext "Campsites" "title" )}}</a></li>
<li><a href="/admin/campsites/types">{{( pgettext "Campsite Types" "title" )}}</a></li>
<li><a href="/admin/campsites/types/{{ .TypeSlug }}/options">{{( pgettext "Campsite Type Options" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.optionForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.optionForm*/ -}}
<form <form

View File

@ -6,6 +6,11 @@
{{( pgettext "Campsite Type Options" "title" )}} {{( pgettext "Campsite Type Options" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/campsites">{{( pgettext "Campsites" "title" )}}</a></li>
<li><a href="/admin/campsites/types">{{( pgettext "Campsite Types" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.optionIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.optionIndex*/ -}}
<a href="/admin/campsites/types/{{ .TypeSlug }}/options/new">{{( pgettext "Add Option" "action" )}}</a> <a href="/admin/campsites/types/{{ .TypeSlug }}/options/new">{{( pgettext "Add Option" "action" )}}</a>

View File

@ -11,6 +11,11 @@
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="./../">{{( pgettext "Campsites" "title" )}}</a></li>
<li><a href="./">{{( pgettext "Campsite Types" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.typeForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.typeForm*/ -}}
<form <form

View File

@ -6,6 +6,10 @@
{{( pgettext "Campsite Types" "title" )}} {{( pgettext "Campsite Types" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="./">{{( pgettext "Campsites" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.typeIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.typeIndex*/ -}}
<a href="/admin/campsites/types/new">{{( pgettext "Add Type" "action" )}}</a> <a href="/admin/campsites/types/new">{{( pgettext "Add Type" "action" )}}</a>

View File

@ -11,6 +11,9 @@
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/carousel.slideForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/carousel.slideForm*/ -}}
<form <form

View File

@ -6,6 +6,9 @@
{{( pgettext "Dashboard" "title" )}} {{( pgettext "Dashboard" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
<h2>{{( pgettext "Dashboard" "title" )}}</h2> <h2>{{( pgettext "Dashboard" "title" )}}</h2>
{{- end }} {{- end }}

View File

@ -6,6 +6,9 @@
{{( pgettext "Home Page" "title" )}} {{( pgettext "Home Page" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/home.homeIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/home.homeIndex*/ -}}
<h2>{{( pgettext "Cover" "title" )}}</h2> <h2>{{( pgettext "Cover" "title" )}}</h2>

View File

@ -37,7 +37,7 @@
<a href="/admin/company">{{( pgettext "Company Settings" "title" )}}</a> <a href="/admin/company">{{( pgettext "Company Settings" "title" )}}</a>
</li> </li>
<li> <li>
<a href="/admin/booking/payment">{{( pgettext "Payment Settings" "title" )}}</a> <a href="/admin/bookings/payment">{{( pgettext "Payment Settings" "title" )}}</a>
</li> </li>
<li> <li>
<a href="/admin/campsites/types">{{( pgettext "Campsite Types" "title" )}}</a> <a href="/admin/campsites/types">{{( pgettext "Campsite Types" "title" )}}</a>
@ -94,6 +94,15 @@
</ul> </ul>
</nav> </nav>
{{- end }} {{- end }}
{{ block "breadcrumb-nav" . -}}
{{ $label := (gettext "Breadcrumb")}}
<nav aria-label="{{ $label }}" class="breadcrumb">
<ol>
{{- template "breadcrumb" . }}
<li><a aria-current="page" href="">{{ template "title" . }}</a></li>
</ol>
</nav>
{{- end }}
<main id="content"> <main id="content">
{{- template "content" . }} {{- template "content" . }}
</main> </main>

View File

@ -11,6 +11,10 @@
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/legal">{{( pgettext "Legal Texts" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/legal.legalForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/legal.legalForm*/ -}}
<form <form

View File

@ -6,6 +6,9 @@
{{( pgettext "Legal Texts" "title" )}} {{( pgettext "Legal Texts" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/legal.legalIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/legal.legalIndex*/ -}}
<a href="/admin/legal/new">{{( pgettext "Add Legal Text" "action" )}}</a> <a href="/admin/legal/new">{{( pgettext "Add Legal Text" "action" )}}</a>

View File

@ -6,6 +6,9 @@
{{( pgettext "Location Settings" "title" )}} {{( pgettext "Location Settings" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/location.locationForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/location.locationForm*/ -}}
<form data-hx-put="/admin/location"> <form data-hx-put="/admin/location">

View File

@ -6,6 +6,11 @@
{{( pgettext "Login" "title" )}} {{( pgettext "Login" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "breadcrumb-nav" -}}{{""}}{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/app.loginForm */ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/app.loginForm */ -}}
<form id="login-form" method="post" action="/login"> <form id="login-form" method="post" action="/login">

View File

@ -6,6 +6,10 @@
{{( pgettext "Edit Media" "title" )}} {{( pgettext "Edit Media" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/media">{{( pgettext "Media" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.mediaForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.mediaForm*/ -}}
<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 }}">

View File

@ -6,6 +6,9 @@
{{( pgettext "Media" "title" )}} {{( pgettext "Media" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.mediaIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.mediaIndex*/ -}}
<h2>{{( pgettext "Media" "title" )}}</h2> <h2>{{( pgettext "Media" "title" )}}</h2>

View File

@ -6,6 +6,10 @@
{{( pgettext "Upload Media" "title" )}} {{( pgettext "Upload Media" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/media">{{( pgettext "Media" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.uploadForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/media.uploadForm*/ -}}
<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">

View File

@ -6,6 +6,9 @@
{{( pgettext "Profile" "title" )}} {{( pgettext "Profile" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/app.profileForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/app.profileForm*/ -}}
<form data-hx-put="/me" enctype="multipart/form-data"> <form data-hx-put="/me" enctype="multipart/form-data">

View File

@ -11,6 +11,10 @@
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/seasons">{{( pgettext "Season" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/season.seasonForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/season.seasonForm*/ -}}
<form <form

View File

@ -6,6 +6,9 @@
{{( pgettext "Seasons" "title" )}} {{( pgettext "Seasons" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/season.seasonIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/season.seasonIndex*/ -}}
<a href="/admin/seasons/new">{{( pgettext "Add Season" "action" )}}</a> <a href="/admin/seasons/new">{{( pgettext "Add Season" "action" )}}</a>

View File

@ -6,6 +6,9 @@
{{( pgettext "Services Page" "title" )}} {{( pgettext "Services Page" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/services.servicesIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/services.servicesIndex*/ -}}
<h2>{{( pgettext "Carousel" "title" )}}</h2> <h2>{{( pgettext "Carousel" "title" )}}</h2>

View File

@ -11,6 +11,10 @@
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/surroundings">{{( pgettext "Surroundings" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/surroundings.highlightForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/surroundings.highlightForm*/ -}}
<form <form

View File

@ -6,6 +6,9 @@
{{( pgettext "Surroundings Page" "title" )}} {{( pgettext "Surroundings Page" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/surroundings.highlightIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/surroundings.highlightIndex*/ -}}
<h2>{{( pgettext "Highlights" "title" )}}</h2> <h2>{{( pgettext "Highlights" "title" )}}</h2>

View File

@ -6,6 +6,9 @@
{{( pgettext "Tax Details" "title" )}} {{( pgettext "Tax Details" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/company.taxDetailsForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/company.taxDetailsForm*/ -}}
<form data-hx-put="/admin/company"> <form data-hx-put="/admin/company">

View File

@ -6,6 +6,9 @@
{{( pgettext "Users" "title" )}} {{( pgettext "Users" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/user.userIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/user.userIndex*/ -}}
<a href="/admin/users/new">{{( pgettext "Add User" "action" )}}</a> <a href="/admin/users/new">{{( pgettext "Add User" "action" )}}</a>

View File

@ -6,6 +6,10 @@
{{( pgettext "Login Attempts" "title" )}} {{( pgettext "Login Attempts" "title" )}}
{{- end }} {{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/users">{{( pgettext "Users" "title" )}}</a></li>
{{- end }}
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/user.loginAttemptIndex*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/user.loginAttemptIndex*/ -}}
<h2>{{( pgettext "Login Attempts" "title" )}}</h2> <h2>{{( pgettext "Login Attempts" "title" )}}</h2>