Skip to content

Commit 26d0130

Browse files
various small things
1 parent e790997 commit 26d0130

File tree

36 files changed

+733
-115
lines changed

36 files changed

+733
-115
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Generated by Django 4.2.7 on 2024-11-06 23:54
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('events', '0014_eventownerpage_applied_text'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='eventownerpage',
15+
name='date_date_text',
16+
field=models.CharField(default='date'),
17+
),
18+
migrations.AddField(
19+
model_name='eventownerpage',
20+
name='date_from_text',
21+
field=models.CharField(default='From'),
22+
),
23+
migrations.AddField(
24+
model_name='eventownerpage',
25+
name='date_to_text',
26+
field=models.CharField(default='To'),
27+
),
28+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 4.2.7 on 2024-11-07 17:06
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('events', '0015_eventownerpage_date_date_text_and_more'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='eventownerpage',
15+
name='date_date_text',
16+
field=models.CharField(default='Filter by Date'),
17+
),
18+
]

app/events/models.py

+14
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from app.members.models import IndividualMappingHubPage
1515
from app.core.models import LinkOrPageBlock
1616

17+
from datetime import datetime
18+
1719

1820
class EventOwnerPage(Page):
1921
def get_context(self, request, *args, **kwargs):
@@ -46,6 +48,12 @@ def get_context(self, request, *args, **kwargs):
4648
if request.GET.get("hub" + str(hub.id), ''):
4749
query = query | Q(event_region_hub=hub)
4850
events_list = events_list.filter(query).distinct()
51+
52+
from_date = request.GET.get("fromdate")
53+
from_date = datetime.strptime(from_date, "%Y-%m-%d") if from_date else datetime.min
54+
to_date = request.GET.get("todate")
55+
to_date = datetime.strptime(to_date, "%Y-%m-%d") if to_date else datetime.max
56+
events_list = events_list.filter(Q(start_date_time__range=[from_date,to_date]) | Q(end_date_time__range=[from_date,to_date]))
4957

5058
match request.GET.get('sort', ''):
5159
case 'sort.new':
@@ -101,6 +109,9 @@ def get_context(self, request, *args, **kwargs):
101109
sort_by_old = models.CharField(default="Sort by Old")
102110
sort_by_titlea = models.CharField(default="Sort by Title Alphabetical")
103111
sort_by_titlez = models.CharField(default="Sort by Title Reverse Alphabetical")
112+
date_date_text = models.CharField(default="Filter by Date")
113+
date_from_text = models.CharField(default="From")
114+
date_to_text = models.CharField(default="To")
104115
search_button_text = models.CharField(default="Search")
105116
remove_filters_text = models.CharField(default="Remove All Filters")
106117
results_text = models.CharField(default="Results")
@@ -116,6 +127,9 @@ def get_context(self, request, *args, **kwargs):
116127
FieldPanel('sort_by_old'),
117128
FieldPanel('sort_by_titlea'),
118129
FieldPanel('sort_by_titlez'),
130+
FieldPanel('date_from_text'),
131+
FieldPanel('date_to_text'),
132+
FieldPanel('date_date_text'),
119133
FieldPanel('search_button_text'),
120134
FieldPanel('remove_filters_text'),
121135
FieldPanel('results_text'),

app/events/templates/events/event_owner_page.html

+20
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,26 @@ <h1 class="text-h1 font-semibold my-10">{{page.title}}</h1>
103103
</div>
104104
</div>
105105

106+
<div class="relative" x-data="{ show: false }" @click.away="show = false">
107+
<div class="w-full h-full flex justify-between py-2 px-3 bg-hot-off-white items-center cursor-pointer" @click="show = !show">
108+
<p class="pointer-events-none">
109+
{{page.date_date_text}}
110+
</p>
111+
{% include "ui/components/icon_svgs/LinkCaret.html" with class="rotate-90 text-hot-red" %}
112+
</div>
113+
<div class="absolute z-20 bg-hot-off-white p-4 w-full flex flex-col gap-2" x-show="show">
114+
<hr class="border-b-2 mb-2">
115+
<p>{{page.date_from_text}}</p>
116+
<div class="bg-white flex items-center mb-2">
117+
<input class="w-full bg-transparent border-none" type="date" name="fromdate" :value="params.get('fromdate')">
118+
</div>
119+
<p>{{page.date_to_text}}</p>
120+
<div class="bg-white flex items-center">
121+
<input class="w-full bg-transparent border-none" type="date" name="todate" :value="params.get('todate')">
122+
</div>
123+
</div>
124+
</div>
125+
106126
<div class="bg-hot-red text-white font-semibold">
107127
<input type="submit" value="{{page.search_button_text}}" class="bg-transparent w-full h-full cursor-pointer py-2">
108128
</div>

app/impact_areas/models.py

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class IndividualImpactAreaPage(Page):
2727
def get_context(self, request, *args, **kwargs):
2828
context = super().get_context(request, *args, **kwargs)
2929

30+
context['baseid'] = str(context['page'].get_translation(1).id)
31+
3032
projects_list = IndividualProjectPage.objects.live().filter(
3133
Q(impact_area_list__contains=[{'type': 'impact_area', 'value': context['page'].get_translation(1).id}])
3234
).filter(locale=context['page'].locale)

app/impact_areas/templates/impact_areas/individual_impact_area_page.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
{% comment %} PROJECTS {% endcomment %}
4343
<div class="my-20" id="projects-section">
44-
{% include "ui/components/FlexTitleWithLink.html" with title=page.get_parent.specific.projects_title linktext=page.get_parent.specific.view_all_projects_text linkurl=page.get_parent.specific.view_all_projects_url titleclass="text-h2" %}
44+
{% include "ui/components/FlexTitleWithLink.html" with title=page.get_parent.specific.projects_title linktext=page.get_parent.specific.view_all_projects_text linkurl=page.get_parent.specific.view_all_projects_url titleclass="text-h2" linkappendage="?ia"|add:baseid|add:"=on" %}
4545
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8 mt-10" id="projects-list">
4646
{% for project in projects %}
4747
{% include "ui/components/projects/ProjectPreviewBlockNews.html" with project=project showimage=True %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 4.2.7 on 2024-11-06 22:50
2+
3+
from django.db import migrations
4+
import wagtail.fields
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('mapping_hubs', '0022_individualmappinghubpage_hub_portrait_image'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='openmappinghubspage',
16+
name='header_project_link',
17+
field=wagtail.fields.StreamField([('page', 0), ('url', 1), ('document', 2), ('other', 3)], blank=True, block_lookup={0: ('wagtail.blocks.PageChooserBlock', (), {}), 1: ('wagtail.blocks.URLBlock', (), {}), 2: ('wagtail.documents.blocks.DocumentChooserBlock', (), {}), 3: ('wagtail.blocks.CharBlock', (), {'help_text': "Only use this option as a last resort. The other fields are preferred. In cases like email 'mailto' links, however, this field can be used. Ensure that your provided link will function as intended prior to publishing live."})}),
18+
),
19+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Generated by Django 4.2.7 on 2024-11-06 22:52
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('mapping_hubs', '0023_openmappinghubspage_header_project_link'),
10+
]
11+
12+
operations = [
13+
migrations.DeleteModel(
14+
name='MappingHubProjectsPage',
15+
),
16+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 4.2.7 on 2024-11-06 22:55
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('mapping_hubs', '0024_delete_mappinghubprojectspage'),
10+
]
11+
12+
operations = [
13+
migrations.RemoveField(
14+
model_name='individualmappinghubpage',
15+
name='header_project_link',
16+
),
17+
]

app/mapping_hubs/models.py

+2-47
Original file line numberDiff line numberDiff line change
@@ -34,51 +34,6 @@ class DogearBoxBlock(StreamBlock):
3434
blocks = DogearBoxStructBlock()
3535

3636

37-
class MappingHubProjectsPage(Page):
38-
def get_context(self, request):
39-
context = super().get_context(request)
40-
41-
parent_hub = context['page'].get_parent()
42-
43-
base_id = parent_hub.get_translation(1).id
44-
45-
projects = IndividualProjectPage.objects.live().filter(
46-
Q(region_hub_list__contains=[{'type': 'region_hub', 'value': base_id}])
47-
).filter(locale=context['page'].locale)
48-
49-
other_hubs_projects = MappingHubProjectsPage.objects.live().filter(locale=context['page'].locale)
50-
51-
context['projects'] = projects
52-
context['other_hubs'] = other_hubs_projects
53-
return context
54-
55-
parent_page_types = [
56-
'mapping_hubs.IndividualMappingHubPage'
57-
]
58-
59-
load_more_projects_text = models.CharField(default="Load More Projects")
60-
61-
projects_by_hub_title = models.CharField(default="See Projects by Open Mapping Hub")
62-
63-
red_box_title = models.CharField(default="See all of HOT's projects")
64-
red_box_link_text = models.CharField(default="Explore projects")
65-
red_box_link = StreamField(LinkOrPageBlock(), use_json_field=True, blank=True)
66-
black_box_title = models.CharField(default="See the many ways to get involved with HOT and open mapping")
67-
black_box_link_text = models.CharField(default="Get involved")
68-
black_box_link = StreamField(LinkOrPageBlock(), use_json_field=True, blank=True)
69-
70-
content_panels = Page.content_panels + [
71-
FieldPanel('load_more_projects_text'),
72-
FieldPanel('projects_by_hub_title'),
73-
FieldPanel('red_box_title'),
74-
FieldPanel('red_box_link_text'),
75-
FieldPanel('red_box_link'),
76-
FieldPanel('black_box_title'),
77-
FieldPanel('black_box_link_text'),
78-
FieldPanel('black_box_link'),
79-
]
80-
81-
8237
class OpenMappingHubsPage(Page):
8338
max_count = 1
8439

@@ -101,6 +56,7 @@ class OpenMappingHubsPage(Page):
10156
header_hub_text_white = models.CharField(default="Open Mapping")
10257
header_hub_text_red = models.CharField(default="Hub")
10358
header_project_link_text = models.CharField(default="Projects")
59+
header_project_link = StreamField(LinkOrPageBlock(), use_json_field=True, blank=True)
10460
header_news_link_text = models.CharField(default="News")
10561
header_news_link = StreamField(LinkOrPageBlock(), use_json_field=True, blank=True)
10662
header_events_link_text = models.CharField(default="Events")
@@ -126,6 +82,7 @@ class OpenMappingHubsPage(Page):
12682
FieldPanel('header_hub_text_white'),
12783
FieldPanel('header_hub_text_red'),
12884
FieldPanel('header_project_link_text'),
85+
FieldPanel('header_project_link'),
12986
FieldPanel('header_news_link_text'),
13087
FieldPanel('header_news_link'),
13188
FieldPanel('header_events_link_text'),
@@ -193,7 +150,6 @@ def get_context(self, request):
193150
related_name="+",
194151
help_text="Header image",
195152
)
196-
header_project_link = StreamField(LinkOrPageBlock(), use_json_field=True, blank=True)
197153
header_carousel = StreamField(CarouselBlock(max_num=3, min_num=3), blank=True, use_json_field=True, null=True)
198154

199155
project_section_title = models.CharField()
@@ -232,7 +188,6 @@ def get_context(self, request):
232188
], heading="Main"),
233189
MultiFieldPanel([
234190
FieldPanel('header_image'),
235-
FieldPanel('header_project_link'),
236191
FieldPanel('header_carousel'),
237192
], heading="Header"),
238193
MultiFieldPanel([

app/mapping_hubs/templates/mapping_hubs/components/header.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h1 class="text-h1 font-semibold mb-4">
2020
</h1>
2121
<div class="grid gap-4">
2222
<p>
23-
{% include "ui/components/BaseLinkNoUnderlineWhite.html" with linkurl=page.header_project_link linktext=page.get_parent.specific.header_project_link_text %}
23+
{% include "ui/components/BaseLinkNoUnderlineWhite.html" with linkurl=page.get_parent.specific.header_project_link linktext=page.get_parent.specific.header_project_link_text linkappendage="?hub"|add:original_id|add:"=on" %}
2424
</p>
2525
{% with page.id|stringformat:"s" as id %}
2626
<p>

app/mapping_hubs/templates/mapping_hubs/individual_mapping_hub_page.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{% include "ui/components/SectionHeadingWithUnderline.html" with title=page.project_section_title %}
3131
</div>
3232
<div class="text-left lg:text-right text-intro mt-4 lg:mt-0 self-center">
33-
{% include "ui/components/BaseLink.html" with linktext=page.project_section_link_text linkurl=page.project_section_link %}
33+
{% include "ui/components/BaseLink.html" with linktext=page.project_section_link_text linkurl=page.get_parent.specific.header_project_link linkappendage="?hub"|add:original_id|add:"=on" %}
3434
</div>
3535
</div>
3636
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-10 py-6">

app/misc/templates/misc/components/OurApproachWhatWeDo.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</g>
2727
<text id="Develop_accessible_open-source_mapping_products" data-name="{{page.what_we_do_items.2.value}}" transform="translate(504 333)" font-size="20" font-family="inherit" font-weight="500"><tspan x="0" y="18">{{page.what_we_do_items.2.value}}</tspan></text>
2828
<ellipse id="Ellipse_320" data-name="Ellipse 320" cx="199.5" cy="200" rx="199.5" ry="200" fill="#f0efef"/>
29-
<text id="What_We_Do" data-name="What We Do" transform="translate(79 182)" font-size="38" font-family="inherit" font-weight="700" text-anchor="middle"><tspan x="125" y="33">What We Do</tspan></text>
29+
<text id="What_We_Do" data-name="{{page.what_we_do_title}}" transform="translate(79 182)" font-size="38" font-family="inherit" font-weight="700" text-anchor="middle"><tspan x="125" y="33">{{page.what_we_do_title}}</tspan></text>
3030
<g id="Mask_Group_13" data-name="Mask Group 13" transform="translate(-71 -602)" clip-path="url(#clip-path)">
3131
<g id="Ellipse_360" data-name="Ellipse 360" transform="translate(-33 506)" fill="none" stroke="#c4c4c4" stroke-width="3" stroke-dasharray="5 8">
3232
<circle cx="294" cy="294" r="294" stroke="none"/>

app/misc/templates/misc/components/OurApproachWhatWeDoMobile.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</clipPath>
88
</defs>
99
<circle id="Ellipse_320" data-name="Ellipse 320" cx="175" cy="175" r="175" fill="#f0efef"/>
10-
<text id="What_We_Do" data-name="What We Do" transform="translate(54 157)" font-size="32" font-family="inherit" font-weight="700"><tspan x="29.352" y="28">What We Do</tspan></text>
10+
<text id="What_We_Do" data-name="{{page.what_we_do_title}}" transform="translate(54 157)" font-size="32" font-family="inherit" font-weight="700"><tspan x="29.352" y="28">{{page.what_we_do_title}}</tspan></text>
1111
<g id="Mask_Group_13" data-name="Mask Group 13" transform="translate(954 -140) rotate(90)" clip-path="url(#clip-path)" style="clip-path: ellipse(500px 150px);">
1212
<g id="Ellipse_360" data-name="Ellipse 360" transform="translate(-33 521)" fill="none" stroke="#c4c4c4" stroke-width="3" stroke-dasharray="5 8">
1313
<ellipse cx="294" cy="255" rx="294" ry="255" stroke="none"/>

app/misc/templates/misc/contact_us_page.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ <h1 class="text-h2 font-bold">
9898
</div>
9999

100100
<div class="text-black mt-20 pb-20 [&_h1]:text-black [&_a]:text-black">
101-
{% include "ui/components/dogear_boxes/DogearAnyColourLong.html" with colour="var(--hot-off-white)" title=page.dogear_box_title linktext=page.dogear_box_link_text linkurl=page.dogear_box_link %}
101+
{% include "ui/components/dogear_boxes/DogearAnyColourLong.html" with colour="var(--hot-off-white)" title=page.dogear_box_title linktext=page.dogear_box_link_text linkurl=page.dogear_box_link variableicon=True %}
102102
</div>
103103
</div>
104104
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 4.2.7 on 2024-11-06 23:12
2+
3+
from django.db import migrations
4+
import wagtail.fields
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('our_work', '0005_alter_ourworkpage_black_box_link_and_more'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='ourworkpage',
16+
name='projects_link',
17+
field=wagtail.fields.StreamField([('page', 0), ('url', 1), ('document', 2), ('other', 3)], blank=True, block_lookup={0: ('wagtail.blocks.PageChooserBlock', (), {}), 1: ('wagtail.blocks.URLBlock', (), {}), 2: ('wagtail.documents.blocks.DocumentChooserBlock', (), {}), 3: ('wagtail.blocks.CharBlock', (), {'help_text': "Only use this option as a last resort. The other fields are preferred. In cases like email 'mailto' links, however, this field can be used. Ensure that your provided link will function as intended prior to publishing live."})}),
18+
),
19+
]

app/our_work/models.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from app.projects.models import IndividualProjectPage, ProjectType, ProjectStatus
1616
from app.impact_areas.models import IndividualImpactAreaPage
17-
from app.mapping_hubs.models import MappingHubProjectsPage, IndividualMappingHubPage
17+
from app.mapping_hubs.models import IndividualMappingHubPage
1818
from app.programs.models import IndividualProgramPage
1919
from app.core.models import LinkOrPageBlock
2020

@@ -97,7 +97,6 @@ def get_context(self, request, *args, **kwargs):
9797
context['paginator'] = paginator
9898
context['impact_areas'] = IndividualImpactAreaPage.objects.live().filter(locale=base_locale)
9999
context['hubs'] = IndividualMappingHubPage.objects.live().filter(locale=base_locale)
100-
context['hubs_projects'] = MappingHubProjectsPage.objects.live().filter(locale=base_locale)
101100
context['programs'] = IndividualProgramPage.objects.live().filter(locale=base_locale)
102101
context['types'] = ProjectType.objects.all()
103102
context['statuses'] = ProjectStatus.objects.all()
@@ -176,6 +175,7 @@ def serve(self, request, *args, **kwargs):
176175
no_projects_found = models.CharField(default="No projects found with the applied filters.")
177176
impact_area_title = models.CharField(default="See Projects by Impact Area")
178177
open_mapping_hub_title = models.CharField(default="See Projects by Open Mapping Hub")
178+
projects_link = StreamField(LinkOrPageBlock(), use_json_field=True, blank=True)
179179

180180
red_box_title = models.CharField(default="Check our upcoming events!")
181181
red_box_link_text = models.CharField(default="View all events")
@@ -218,6 +218,7 @@ def serve(self, request, *args, **kwargs):
218218
MultiFieldPanel([
219219
FieldPanel('impact_area_title'),
220220
FieldPanel('open_mapping_hub_title'),
221+
FieldPanel('projects_link'),
221222
FieldPanel('red_box_title'),
222223
FieldPanel('red_box_link_text'),
223224
FieldPanel('red_box_link'),

0 commit comments

Comments
 (0)