add lead to associations
This commit is contained in:
19
dnscms/associations/migrations/0025_associationpage_lead.py
Normal file
19
dnscms/associations/migrations/0025_associationpage_lead.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 5.0.7 on 2024-08-09 01:34
|
||||||
|
|
||||||
|
import wagtail.fields
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('associations', '0024_alter_associationpage_website_url'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='associationpage',
|
||||||
|
name='lead',
|
||||||
|
field=wagtail.fields.RichTextField(blank=True),
|
||||||
|
),
|
||||||
|
]
|
@ -47,6 +47,7 @@ class AssociationPage(WPImportedPageMixin, Page):
|
|||||||
UTVALG = "utvalg", "Utvalg"
|
UTVALG = "utvalg", "Utvalg"
|
||||||
|
|
||||||
excerpt = models.TextField(max_length=512, blank=False)
|
excerpt = models.TextField(max_length=512, blank=False)
|
||||||
|
lead = RichTextField(features=["italic", "link"], blank=True)
|
||||||
body = CommonStreamField
|
body = CommonStreamField
|
||||||
association_type = models.CharField(
|
association_type = models.CharField(
|
||||||
max_length=64, choices=AssociationType, default=AssociationType.FORENING
|
max_length=64, choices=AssociationType, default=AssociationType.FORENING
|
||||||
@ -66,7 +67,8 @@ class AssociationPage(WPImportedPageMixin, Page):
|
|||||||
heading="Utdrag",
|
heading="Utdrag",
|
||||||
help_text="En veldig kort oppsummering av innholdet nedenfor. Brukes i listevisninger.",
|
help_text="En veldig kort oppsummering av innholdet nedenfor. Brukes i listevisninger.",
|
||||||
),
|
),
|
||||||
FieldPanel("body"),
|
FieldPanel("lead", heading="Ingress"),
|
||||||
|
FieldPanel("body", heading="Innhold"),
|
||||||
FieldPanel("logo"),
|
FieldPanel("logo"),
|
||||||
FieldPanel("association_type", heading="Type"),
|
FieldPanel("association_type", heading="Type"),
|
||||||
FieldPanel("website_url", heading="Nettside"),
|
FieldPanel("website_url", heading="Nettside"),
|
||||||
@ -74,6 +76,7 @@ class AssociationPage(WPImportedPageMixin, Page):
|
|||||||
|
|
||||||
graphql_fields = [
|
graphql_fields = [
|
||||||
GraphQLString("excerpt"),
|
GraphQLString("excerpt"),
|
||||||
|
GraphQLRichText("lead"),
|
||||||
GraphQLStreamfield("body"),
|
GraphQLStreamfield("body"),
|
||||||
GraphQLImage("logo"),
|
GraphQLImage("logo"),
|
||||||
GraphQLString("website_url"),
|
GraphQLString("website_url"),
|
||||||
|
@ -73,6 +73,12 @@ export default async function Page({ params }: { params: { slug: string } }) {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
{association.lead && (
|
||||||
|
<div
|
||||||
|
className="lead"
|
||||||
|
dangerouslySetInnerHTML={{ __html: association.lead }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<PageContent blocks={association.body} />
|
<PageContent blocks={association.body} />
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
|
@ -25,6 +25,7 @@ const AssociationFragmentDefinition = graphql(`
|
|||||||
slug
|
slug
|
||||||
title
|
title
|
||||||
excerpt
|
excerpt
|
||||||
|
lead
|
||||||
body {
|
body {
|
||||||
...Blocks
|
...Blocks
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ const documents = {
|
|||||||
"\n query allAssociationSlugs {\n pages(contentType: \"associations.AssociationPage\") {\n id\n slug\n }\n }\n ": types.AllAssociationSlugsDocument,
|
"\n query allAssociationSlugs {\n pages(contentType: \"associations.AssociationPage\") {\n id\n slug\n }\n }\n ": types.AllAssociationSlugsDocument,
|
||||||
"\n query associationBySlug($slug: String!) {\n association: page(\n contentType: \"associations.AssociationPage\"\n slug: $slug\n ) {\n ... on AssociationPage {\n ...Association\n }\n }\n }\n ": types.AssociationBySlugDocument,
|
"\n query associationBySlug($slug: String!) {\n association: page(\n contentType: \"associations.AssociationPage\"\n slug: $slug\n ) {\n ... on AssociationPage {\n ...Association\n }\n }\n }\n ": types.AssociationBySlugDocument,
|
||||||
"\n fragment AssociationIndex on AssociationIndex {\n ... on AssociationIndex {\n title\n lead\n body {\n ...Blocks\n }\n }\n }\n": types.AssociationIndexFragmentDoc,
|
"\n fragment AssociationIndex on AssociationIndex {\n ... on AssociationIndex {\n title\n lead\n body {\n ...Blocks\n }\n }\n }\n": types.AssociationIndexFragmentDoc,
|
||||||
"\n fragment Association on AssociationPage {\n __typename\n id\n slug\n title\n excerpt\n body {\n ...Blocks\n }\n logo {\n url\n width\n height\n }\n associationType\n websiteUrl\n }\n": types.AssociationFragmentDoc,
|
"\n fragment Association on AssociationPage {\n __typename\n id\n slug\n title\n excerpt\n lead\n body {\n ...Blocks\n }\n logo {\n url\n width\n height\n }\n associationType\n websiteUrl\n }\n": types.AssociationFragmentDoc,
|
||||||
"\n query allAssociations {\n index: associationIndex {\n ... on AssociationIndex {\n ...AssociationIndex\n }\n }\n associations: pages(contentType: \"associations.AssociationPage\", limit: 1000) {\n ... on AssociationPage {\n ...Association\n }\n }\n }\n ": types.AllAssociationsDocument,
|
"\n query allAssociations {\n index: associationIndex {\n ... on AssociationIndex {\n ...AssociationIndex\n }\n }\n associations: pages(contentType: \"associations.AssociationPage\", limit: 1000) {\n ... on AssociationPage {\n ...Association\n }\n }\n }\n ": types.AllAssociationsDocument,
|
||||||
"\n fragment ContactIndex on ContactIndex {\n ... on ContactIndex {\n title\n lead\n body {\n ...Blocks\n }\n }\n }\n": types.ContactIndexFragmentDoc,
|
"\n fragment ContactIndex on ContactIndex {\n ... on ContactIndex {\n title\n lead\n body {\n ...Blocks\n }\n }\n }\n": types.ContactIndexFragmentDoc,
|
||||||
"\n query contacts {\n contactIndex {\n ... on ContactIndex {\n ...ContactIndex\n }\n }\n }\n ": types.ContactsDocument,
|
"\n query contacts {\n contactIndex {\n ... on ContactIndex {\n ...ContactIndex\n }\n }\n }\n ": types.ContactsDocument,
|
||||||
@ -109,7 +109,7 @@ export function graphql(source: "\n fragment AssociationIndex on AssociationInd
|
|||||||
/**
|
/**
|
||||||
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
* 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 Association on AssociationPage {\n __typename\n id\n slug\n title\n excerpt\n body {\n ...Blocks\n }\n logo {\n url\n width\n height\n }\n associationType\n websiteUrl\n }\n"): (typeof documents)["\n fragment Association on AssociationPage {\n __typename\n id\n slug\n title\n excerpt\n body {\n ...Blocks\n }\n logo {\n url\n width\n height\n }\n associationType\n websiteUrl\n }\n"];
|
export function graphql(source: "\n fragment Association on AssociationPage {\n __typename\n id\n slug\n title\n excerpt\n lead\n body {\n ...Blocks\n }\n logo {\n url\n width\n height\n }\n associationType\n websiteUrl\n }\n"): (typeof documents)["\n fragment Association on AssociationPage {\n __typename\n id\n slug\n title\n excerpt\n lead\n body {\n ...Blocks\n }\n logo {\n url\n width\n height\n }\n associationType\n websiteUrl\n }\n"];
|
||||||
/**
|
/**
|
||||||
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
* 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
Reference in New Issue
Block a user