add support for hiding venues from /lokaler

This commit is contained in:
2024-08-09 19:22:36 +02:00
parent b71b509894
commit 344c8745d6
5 changed files with 40 additions and 8 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 5.0.7 on 2024-08-09 17:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('venues', '0023_alter_venuepage_images'),
]
operations = [
migrations.AddField(
model_name='venuepage',
name='show_in_overview',
field=models.BooleanField(default=True, help_text='Skal lokalet vises i oversikten over lokaler på undersiden /lokaler?'),
),
migrations.AlterField(
model_name='venuepage',
name='show_as_bookable',
field=models.BooleanField(default=True, help_text='Skal lokalet vises i oversikten over lokaler som leies ut?'),
),
]

View File

@ -85,7 +85,11 @@ class VenuePage(WPImportedPageMixin, Page):
body = CommonStreamField
show_as_bookable = models.BooleanField(
default=True, help_text="Skal lokalet dukke i oversikten over lokaler som leies ut?"
default=True, help_text="Skal lokalet vises i oversikten over lokaler som leies ut?"
)
show_in_overview = models.BooleanField(
default=True,
help_text="Skal lokalet vises i oversikten over lokaler på undersiden /lokaler?",
)
floor = models.CharField(
blank=True,
@ -138,6 +142,7 @@ class VenuePage(WPImportedPageMixin, Page):
FieldPanel("floor", heading="Etasje"),
FieldPanel("preposition", heading="Preposisjon"),
FieldPanel("show_as_bookable", heading="Vis på utleieside"),
FieldPanel("show_in_overview", heading="Vis i lokaleoversikt"),
FieldPanel("used_for", heading="Egnet for"),
MultiFieldPanel(
heading="Kapabiliteter",
@ -159,6 +164,7 @@ class VenuePage(WPImportedPageMixin, Page):
GraphQLString("used_for"),
GraphQLString("tech_specs_url"),
GraphQLBoolean("show_as_bookable"),
GraphQLBoolean("show_in_overview"),
GraphQLString("capability_audio"),
GraphQLString("capability_audio_video"),
GraphQLString("capability_bar"),

View File

@ -33,6 +33,7 @@ const VenueFragmentDefinition = graphql(`
...Image
}
showAsBookable
showInOverview
floor
preposition
usedFor
@ -65,6 +66,7 @@ export default async function Page() {
const { data, error } = await getClient().query(venueIndexQuery, {});
const index = (data?.index ?? []) as VenueIndexFragment;
const venues = (data?.venues ?? []) as VenueFragment[];
const visibleVenues = venues.filter((x) => x.showInOverview);
return (
<main className="site-main" id="main">

View File

@ -30,7 +30,7 @@ const documents = {
"\n query allVenueSlugs {\n pages(contentType: \"venues.VenuePage\", limit: 100) {\n id\n slug\n }\n }\n ": types.AllVenueSlugsDocument,
"\n query venueBySlug($slug: String!) {\n venue: page(contentType: \"venues.VenuePage\", slug: $slug) {\n ... on VenuePage {\n ...Venue\n }\n }\n }\n ": types.VenueBySlugDocument,
"\n fragment VenueIndex on VenueIndex {\n ... on VenueIndex {\n title\n lead\n body {\n ...Blocks\n }\n }\n }\n": types.VenueIndexFragmentDoc,
"\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n images {\n ...Blocks\n }\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n floor\n preposition\n usedFor\n techSpecsUrl\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\n }\n": types.VenueFragmentDoc,
"\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n images {\n ...Blocks\n }\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n showInOverview\n floor\n preposition\n usedFor\n techSpecsUrl\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\n }\n": types.VenueFragmentDoc,
"\n query venueIndex {\n index: venueIndex {\n ... on VenueIndex {\n ...VenueIndex\n }\n }\n venues: pages(contentType: \"venues.VenuePage\", limit: 100) {\n ... on VenuePage {\n ...Venue\n }\n }\n }\n ": types.VenueIndexDocument,
"\n fragment Home on HomePage {\n ... on HomePage {\n featuredEvents {\n id\n }\n }\n }\n": types.HomeFragmentDoc,
"\n query home {\n events: eventIndex {\n ... on EventIndex {\n futureEvents {\n ... on EventPage {\n ...Event\n }\n }\n }\n }\n home: page(contentType: \"home.HomePage\", urlPath: \"/home/\") {\n ... on HomePage {\n ...Home\n }\n }\n news: pages(contentType: \"news.newsPage\", order: \"-first_published_at\", limit: 4) {\n ... on NewsPage {\n ...News\n }\n }\n }\n ": types.HomeDocument,
@ -137,7 +137,7 @@ export function graphql(source: "\n fragment VenueIndex on VenueIndex {\n ..
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n images {\n ...Blocks\n }\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n floor\n preposition\n usedFor\n techSpecsUrl\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\n }\n"): (typeof documents)["\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n images {\n ...Blocks\n }\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n floor\n preposition\n usedFor\n techSpecsUrl\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\n }\n"];
export function graphql(source: "\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n images {\n ...Blocks\n }\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n showInOverview\n floor\n preposition\n usedFor\n techSpecsUrl\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\n }\n"): (typeof documents)["\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n images {\n ...Blocks\n }\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n showInOverview\n floor\n preposition\n usedFor\n techSpecsUrl\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/

File diff suppressed because one or more lines are too long