Show only active campsite types

Relaxed the `max-width: 25%` to fill the whole row in the home page;
it is very unlikely that they will have lees than four types, though.
This commit is contained in:
jordi fita mas 2023-09-12 12:47:50 +02:00
parent 75aa8900b6
commit 2a5751afd5
3 changed files with 18 additions and 23 deletions

View File

@ -65,7 +65,7 @@ type campsiteType struct {
}
func mustCollectCampsiteTypes(ctx context.Context, company *auth.Company, conn *database.Conn, loc *locale.Locale) []*campsiteType {
rows, err := conn.Query(ctx, "select name, '/campsites/types/' || slug, '/media/' || encode(hash, 'hex') || '/' || original_filename from campsite_type join media using (media_id) where campsite_type.company_id = $1", company.ID)
rows, err := conn.Query(ctx, "select name, '/campsites/types/' || slug, '/media/' || encode(hash, 'hex') || '/' || original_filename from campsite_type join media using (media_id) where campsite_type.company_id = $1 and campsite_type.active", company.ID)
if err != nil {
panic(err)
}

View File

@ -40,7 +40,7 @@ func (p *PublicPage) Setup(r *http.Request, user *auth.User, company *auth.Compa
sort.Slice(p.LocalizedAlternates, func(i, j int) bool { return p.LocalizedAlternates[i].Lang < p.LocalizedAlternates[j].Lang })
p.Menu = &siteMenu{
CampsiteTypes: mustCollectMenuItems(r.Context(), conn, user.Locale, "select name, '/campsites/types/' || slug from campsite_type where company_id = $1", company.ID),
CampsiteTypes: mustCollectMenuItems(r.Context(), conn, user.Locale, "select name, '/campsites/types/' || slug from campsite_type where company_id = $1 and active", company.ID),
}
}

View File

@ -378,7 +378,6 @@ nav .has-submenu:hover ul, nav .has-submenu:focus-within ul {
.nature section {
flex: 1;
max-width: 25%;
}
.nature section h3 {
@ -398,6 +397,22 @@ nav .has-submenu:hover ul, nav .has-submenu:focus-within ul {
border-bottom-right-radius: 5px;
}
@media (max-width: 64rem) {
.nature div + div {
flex-direction: column;
}
}
@media (max-width: 48rem) {
.nature div:first-child {
flex-direction: column;
}
.nature h2 {
width: 100%;
}
}
.services {
justify-content: end;
background-color: var(--accent);
@ -497,23 +512,3 @@ footer {
text-align: center;
padding: 2.5rem;
}
@media (max-width: 64rem) {
.nature div + div {
flex-direction: column;
}
.nature section {
max-width: 100%;
}
}
@media (max-width: 48rem) {
.nature div:first-child {
flex-direction: column;
}
.nature h2 {
width: 100%;
}
}