Skip to content

Commit 3d7f3a8

Browse files
Merge pull request #37 from hotosm/adjustments/page-changes-various
Adjustments/page changes various
2 parents 5cf2942 + 547748d commit 3d7f3a8

34 files changed

+799
-149
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 4.2.7 on 2024-08-01 22:06
2+
3+
from django.db import migrations
4+
import wagtail.fields
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('impact_areas', '0015_alter_individualimpactareapage_external_icon'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='impactareaspage',
16+
name='description',
17+
field=wagtail.fields.RichTextField(blank=True),
18+
),
19+
migrations.AddField(
20+
model_name='impactareaspage',
21+
name='header_text',
22+
field=wagtail.fields.RichTextField(blank=True),
23+
),
24+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 4.2.7 on 2024-08-01 22:17
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('impact_areas', '0016_impactareaspage_description_and_more'),
10+
]
11+
12+
operations = [
13+
migrations.RemoveField(
14+
model_name='impactareaspage',
15+
name='impact_area_blocks',
16+
),
17+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Generated by Django 4.2.7 on 2024-08-02 17:03
2+
3+
from django.db import migrations
4+
import wagtail.blocks
5+
import wagtail.fields
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('impact_areas', '0017_remove_impactareaspage_impact_area_blocks'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='individualimpactareapage',
17+
name='use_cases',
18+
field=wagtail.fields.StreamField([('blocks', wagtail.blocks.StructBlock([('description', wagtail.blocks.RichTextBlock()), ('link_text', wagtail.blocks.CharBlock()), ('link', wagtail.blocks.StreamBlock([('page', wagtail.blocks.PageChooserBlock()), ('url', wagtail.blocks.URLBlock())], blank=True, null=True))]))], blank=True, null=True, use_json_field=True),
19+
),
20+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 4.2.7 on 2024-08-02 18:21
2+
3+
from django.db import migrations
4+
import wagtail.fields
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('impact_areas', '0018_alter_individualimpactareapage_use_cases'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='individualimpactareapage',
16+
name='intro',
17+
field=wagtail.fields.RichTextField(blank=True, help_text='This text will not be shown on the page itself, and will instead be shown as the short description for the page for instances such as the Search page or the Impact Areas page.'),
18+
),
19+
]

app/impact_areas/models.py

+14-20
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
1010

1111
from app.projects.models import IndividualProjectPage
12+
from app.core.models import LinkOrPageBlock
1213

1314

1415
class UseCaseStructBlock(StructBlock):
1516
description = RichTextBlock()
1617
link_text = CharBlock()
17-
link_url = URLBlock(blank=True, null=True)
18+
link = LinkOrPageBlock(blank=True, null=True)
1819

1920

2021
class UseCaseBlock(StreamBlock):
@@ -64,6 +65,8 @@ def get_context(self, request, *args, **kwargs):
6465
related_name="+",
6566
help_text="The icon representing this page which is shown for previews of this page on other pages. This should be a purely black image which is ideally as wide as it is tall."
6667
)
68+
intro = RichTextField(blank=True, help_text="This text will not be shown on the page itself, and will instead be shown as the short description for the page for instances such as the Search page or the Impact Areas page.")
69+
6770
intro_image = models.ForeignKey(
6871
"wagtailimages.Image",
6972
null=True,
@@ -72,7 +75,6 @@ def get_context(self, request, *args, **kwargs):
7275
related_name="+",
7376
help_text="Intro image"
7477
)
75-
intro = RichTextField(blank=True)
7678
description = RichTextField(blank=True)
7779

7880
use_cases = StreamField(UseCaseBlock(), use_json_field=True, blank=True, null=True)
@@ -84,8 +86,10 @@ def get_context(self, request, *args, **kwargs):
8486
], heading="Header"),
8587
MultiFieldPanel([
8688
FieldPanel('external_icon'),
87-
FieldPanel('intro_image'),
8889
FieldPanel('intro'),
90+
], heading="External"),
91+
MultiFieldPanel([
92+
FieldPanel('intro_image'),
8993
FieldPanel('description'),
9094
], heading="Body"),
9195
MultiFieldPanel([
@@ -94,25 +98,12 @@ def get_context(self, request, *args, **kwargs):
9498
]
9599

96100

97-
class ImpactAreaStructBlock(StructBlock):
98-
image = ImageChooserBlock()
99-
title = CharBlock()
100-
description = RichTextBlock()
101-
link = URLBlock(required=False)
102-
103-
104-
class ImpactAreaBlock(StreamBlock):
105-
impact_area_block = ImpactAreaStructBlock()
106-
107-
108101
class ImpactAreasPage(Page):
109102
max_count = 1
110103

111104
subpage_types = [
112105
'impact_areas.IndividualImpactAreaPage'
113106
]
114-
115-
intro = RichTextField(blank=True)
116107

117108
image = models.ForeignKey(
118109
"wagtailimages.Image",
@@ -122,8 +113,10 @@ class ImpactAreasPage(Page):
122113
related_name="+",
123114
help_text="Header image"
124115
)
125-
126-
impact_area_blocks = StreamField(ImpactAreaBlock(), use_json_field=True, null=True)
116+
header_text = RichTextField(blank=True)
117+
118+
intro = RichTextField(blank=True)
119+
description = RichTextField(blank=True)
127120

128121
# > IMPACT AREA SHARED FIELDS
129122
use_cases_title = models.CharField(default="Use Cases")
@@ -146,9 +139,10 @@ class ImpactAreasPage(Page):
146139
content_panels = Page.content_panels + [
147140
MultiFieldPanel([
148141
FieldPanel('image'),
149-
FieldPanel('intro')
142+
FieldPanel('header_text'),
150143
], heading="Header section"),
151-
FieldPanel('impact_area_blocks'),
144+
FieldPanel('intro'),
145+
FieldPanel('description'),
152146
MultiFieldPanel([
153147
MultiFieldPanel([
154148
FieldPanel('use_cases_title'),

app/impact_areas/templates/impact_areas/components/UseCaseBox.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ <h1 class="text-hot-red text-h4 font-bold">
55
<div class="my-2">
66
{{ body }}
77
</div>
8-
<a href={{ linkurl }} class="text-hot-red mt-auto font-medium py-2">
8+
<a href="{%include 'ui/components/PageOrLinkHrefText.html'%}" class="text-hot-red mt-auto font-medium py-2">
99
<p>
1010
{{ linktext }}
1111
{% include "ui/components/icon_svgs/LinkCaret.html" %}

app/impact_areas/templates/impact_areas/impact_areas_page.html

+13-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@
1010
{% endblock extra_css %}
1111

1212
{% block content %}
13-
{% include "ui/components/BasePageHeader.html" with title=page.title intro=page.intro image=page.image %}
13+
{% include "ui/components/BasePageHeader.html" with title=page.title intro=page.header_text image=page.image %}
14+
15+
<div class="max-w-7xl mx-auto my-10 lg:grid lg:grid-cols-6">
16+
<div class="px-6 md:px-10 col-span-5">
17+
<div class="text-intro font-semibold">
18+
{{page.intro|richtext}}
19+
</div>
20+
<div class="base-article-m">
21+
{{page.description|richtext}}
22+
</div>
23+
</div>
24+
</div>
1425

15-
<div class="max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-2 lg:gap-4 px-6 mt-6">
26+
<div class="max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-2 gap-8 px-6 md:px-10 mt-6 mb-10">
1627
{% for child in page.get_children %}
1728
{% include "ui/components/impact_areas/ImpactAreaPreviewBlock.html" with ia=child.specific %}
1829
{% endfor %}

app/impact_areas/templates/impact_areas/individual_impact_area_page.html

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,25 @@
1010
{% endblock extra_css %}
1111

1212
{% block content %}
13-
{% include "ui/components/PageHeaderWithBlur.html" with title=page.title subtitle=page.header_text image=page.header_image full_length=True %}
13+
{% include "ui/components/PageHeaderWithBlur.html" with title=page.title subtitle=page.header_text image=page.header_image full_length=True endinlarge=True %}
1414

1515
<div class="max-w-7xl mx-auto mb-20">
1616
<div class="px-8 my-10">
1717
{% comment %} MAIN BODY {% endcomment %}
1818
<div class="grid grid-cols-1 lg:grid-cols-2 gap-x-10">
1919
<div class="base-article-m [&_p:first-child]:mt-0 lg:order-2">
2020
<div class="text-intro font-medium">
21-
{{ page.intro|safe }}
21+
{{ page.description|richtext }}
2222
</div>
23-
{{ page.description|safe }}
2423
</div>
25-
{% image page.intro_image original class="pb-8 lg:order-1" %}
24+
{% image page.intro_image original class="pb-8 lg:order-1 w-full h-auto" %}
2625
</div>
2726

2827
{% comment %} USE CASES {% endcomment %}
2928
{% include "ui/components/SectionHeadingWithUnderline.html" with title=page.get_parent.specific.use_cases_title %}
3029
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8 my-10">
3130
{% for case in page.use_cases %}
32-
{% include "./components/UseCaseBox.html" with number=forloop.counter body=case.value.description linktext=case.value.link_text linkurl=case.value.link_url %}
31+
{% include "./components/UseCaseBox.html" with number=forloop.counter body=case.value.description linktext=case.value.link_text linkurl=case.value.link %}
3332
{% endfor %}
3433
</div>
3534

0 commit comments

Comments
 (0)