From 2b3d3a374d03bce9641f991e76b5e5840df4c157 Mon Sep 17 00:00:00 2001 From: luminaryFlowers <71102109+luminaryFlowers@users.noreply.github.com> Date: Tue, 13 Aug 2024 11:04:27 -0700 Subject: [PATCH] our work page => projects adjusted accordingly with the new fields that have filter options from the our work page => only thing that really remains for this page is mapbox styling but that's done via mapbox's settings if i'm not mistaken; the style in the MapboxScript component will need to be changed to some mapbox style --- ..._type_description_partnertype_type_icon.py | 26 ++ app/core/models.py | 16 +- .../individual_impact_area_page.html | 20 +- app/our_work/__init__.py | 0 app/our_work/admin.py | 3 + app/our_work/apps.py | 6 + app/our_work/migrations/0001_initial.py | 62 ++++ ...workpage_f_project_active_text_and_more.py | 21 ++ ..._ourworkpage_no_projects_found_and_more.py | 38 +++ app/our_work/migrations/__init__.py | 0 app/our_work/models.py | 225 ++++++++++++++ .../components/FilterCategoryPage.html | 14 + .../components/FilterCategorySnippet.html | 14 + .../our_work/components/MapboxMarker.html | 12 + .../our_work/components/MapboxScript.html | 15 + .../components/ProjectSortOption.html | 4 + .../components/ProjectStatusOption.html | 4 + .../templates/our_work/our_work_page.html | 274 ++++++++++++++++++ app/our_work/tests.py | 3 + app/our_work/views.py | 3 + ...ove_partnerwithuspage_partnership_types.py | 17 ++ app/partners/models.py | 15 +- .../partners/partner_with_us_page.html | 8 +- ...projecttype_individualprojectpage_types.py | 26 ++ ...ividualprojectpage_location_coordinates.py | 18 ++ ...30_individualprojectpage_project_active.py | 18 ++ .../migrations/0031_projectstatus_and_more.py | 30 ++ .../0032_alter_projectstatus_options.py | 17 ++ ...dualprojectpage_project_status_and_more.py | 23 ++ .../0034_projectownerpage_types_title.py | 18 ++ app/projects/models.py | 51 +++- .../projects/individual_project_page.html | 67 +++-- app/tech/models.py | 8 + .../ui/components/BasePageHeader.html | 5 +- .../ui/components/CTABodyPanelBase.html | 3 +- .../FooterBannerWithTextAndLink.html | 3 +- .../ui/components/PageHeaderWithBlur.html | 3 +- .../dogear_boxes/DogearContent.html | 3 +- .../dogear_boxes/SpecialDogearLinkBox.html | 3 +- .../events/EventPreviewBlockEvent.html | 3 +- .../ui/components/icon_svgs/FilterIcon.html | 3 + .../ui/components/icon_svgs/MapIcon.html | 5 + .../ui/components/icon_svgs/RefreshIcon.html | 2 +- .../ui/components/icon_svgs/ViewGridIcon.html | 5 + .../impact_areas/ImpactAreaPreviewBlock.html | 3 +- .../ImpactAreaPreviewBlockMini.html | 10 + .../MappingHubPreviewExtendedBlock.html | 3 +- .../MappingHubPreviewProjectsBlock.html | 9 + .../misc_panels/LinkBlockWithImage.html | 3 +- .../navigation/FooterNavigation.html | 3 +- .../news/NewsPreviewBlockProjects.html | 3 +- .../programs/ProgramPreviewBlockBase.html | 3 +- .../sections/BaseSectionWithImage.html | 5 +- .../components/sections/LinkListSection.html | 3 +- .../SmallSectionWithHeaderAndDivider.html | 3 +- .../CheckOutOpportunitiesSection.html | 5 +- .../home/components/ImpactAreasPanel.html | 3 +- .../home/components/MappingHubsPanel.html | 11 +- home/templatetags/homepage_tags.py | 6 + hot_osm/settings/base.py | 9 + hot_osm/templates/base.html | 2 + poetry.lock | 19 +- pyproject.toml | 1 + 63 files changed, 1126 insertions(+), 92 deletions(-) create mode 100644 app/core/migrations/0008_partnertype_type_description_partnertype_type_icon.py create mode 100644 app/our_work/__init__.py create mode 100644 app/our_work/admin.py create mode 100644 app/our_work/apps.py create mode 100644 app/our_work/migrations/0001_initial.py create mode 100644 app/our_work/migrations/0002_remove_ourworkpage_f_project_active_text_and_more.py create mode 100644 app/our_work/migrations/0003_ourworkpage_no_projects_found_and_more.py create mode 100644 app/our_work/migrations/__init__.py create mode 100644 app/our_work/models.py create mode 100644 app/our_work/templates/our_work/components/FilterCategoryPage.html create mode 100644 app/our_work/templates/our_work/components/FilterCategorySnippet.html create mode 100644 app/our_work/templates/our_work/components/MapboxMarker.html create mode 100644 app/our_work/templates/our_work/components/MapboxScript.html create mode 100644 app/our_work/templates/our_work/components/ProjectSortOption.html create mode 100644 app/our_work/templates/our_work/components/ProjectStatusOption.html create mode 100644 app/our_work/templates/our_work/our_work_page.html create mode 100644 app/our_work/tests.py create mode 100644 app/our_work/views.py create mode 100644 app/partners/migrations/0007_remove_partnerwithuspage_partnership_types.py create mode 100644 app/projects/migrations/0028_projecttype_individualprojectpage_types.py create mode 100644 app/projects/migrations/0029_individualprojectpage_location_coordinates.py create mode 100644 app/projects/migrations/0030_individualprojectpage_project_active.py create mode 100644 app/projects/migrations/0031_projectstatus_and_more.py create mode 100644 app/projects/migrations/0032_alter_projectstatus_options.py create mode 100644 app/projects/migrations/0033_remove_individualprojectpage_project_status_and_more.py create mode 100644 app/projects/migrations/0034_projectownerpage_types_title.py create mode 100644 app/ui/templates/ui/components/icon_svgs/FilterIcon.html create mode 100644 app/ui/templates/ui/components/icon_svgs/MapIcon.html create mode 100644 app/ui/templates/ui/components/icon_svgs/ViewGridIcon.html create mode 100644 app/ui/templates/ui/components/impact_areas/ImpactAreaPreviewBlockMini.html create mode 100644 app/ui/templates/ui/components/mapping_hub/MappingHubPreviewProjectsBlock.html diff --git a/app/core/migrations/0008_partnertype_type_description_partnertype_type_icon.py b/app/core/migrations/0008_partnertype_type_description_partnertype_type_icon.py new file mode 100644 index 0000000..0d0f720 --- /dev/null +++ b/app/core/migrations/0008_partnertype_type_description_partnertype_type_icon.py @@ -0,0 +1,26 @@ +# Generated by Django 4.2.7 on 2024-08-07 19:01 + +from django.db import migrations, models +import django.db.models.deletion +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailimages', '0025_alter_image_file_alter_rendition_file'), + ('core', '0007_partnertype_partner_partner_type'), + ] + + operations = [ + migrations.AddField( + model_name='partnertype', + name='type_description', + field=wagtail.fields.RichTextField(blank=True), + ), + migrations.AddField( + model_name='partnertype', + name='type_icon', + field=models.ForeignKey(help_text='Icon for the partner type', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'), + ), + ] diff --git a/app/core/models.py b/app/core/models.py index 49732e3..70b32cc 100644 --- a/app/core/models.py +++ b/app/core/models.py @@ -2,7 +2,7 @@ from django.db import models from wagtail.models import Page -from wagtail.fields import StreamField +from wagtail.fields import StreamField, RichTextField from wagtail.blocks import CharBlock, StreamBlock, StructBlock, URLBlock, RichTextBlock, PageChooserBlock from wagtail.snippets.models import register_snippet from wagtail.admin.panels import FieldPanel, MultiFieldPanel, InlinePanel @@ -11,9 +11,21 @@ @register_snippet class PartnerType(models.Model): type_name = models.CharField() + type_icon = models.ForeignKey( + "wagtailimages.Image", + null=True, + on_delete=models.SET_NULL, + related_name="+", + help_text="Icon for the partner type" + ) + type_description = RichTextField(blank=True) panels = [ - FieldPanel("type_name") + FieldPanel("type_name"), + MultiFieldPanel([ + FieldPanel('type_icon'), + FieldPanel('type_description'), + ], heading="These will show in the Partner With Us page - an info block is automatically created for each partner type.") ] def __str__(self): diff --git a/app/impact_areas/templates/impact_areas/individual_impact_area_page.html b/app/impact_areas/templates/impact_areas/individual_impact_area_page.html index 051925b..8c05f76 100644 --- a/app/impact_areas/templates/impact_areas/individual_impact_area_page.html +++ b/app/impact_areas/templates/impact_areas/individual_impact_area_page.html @@ -33,15 +33,8 @@ {% comment %} PROJECTS {% endcomment %} -
- {% include "ui/components/BaseLink.html" with linktext=page.get_parent.specific.view_all_projects_text linkurl=page.view_all_projects_link %} -
-- {{ area.title }} -
-+ {{title}} +
++ {{title}} +
++ {{page.no_projects_found}} +
+ {% endif %} ++ {% if projects.has_next %} + + {% endif %} +
+{% include "./BaseLink.html" %} diff --git a/app/ui/templates/ui/components/FooterBannerWithTextAndLink.html b/app/ui/templates/ui/components/FooterBannerWithTextAndLink.html index 4006b8c..243407f 100644 --- a/app/ui/templates/ui/components/FooterBannerWithTextAndLink.html +++ b/app/ui/templates/ui/components/FooterBannerWithTextAndLink.html @@ -4,6 +4,7 @@ - buttontext: A string, the text shown in the button - url: A string, the url for the button {% endcomment %} +{% load wagtailcore_tags %}
{{description|safe}}
+{{description|richtext}}
{% endif %}diff --git a/app/ui/templates/ui/components/dogear_boxes/SpecialDogearLinkBox.html b/app/ui/templates/ui/components/dogear_boxes/SpecialDogearLinkBox.html index 495f24f..46eb0f2 100644 --- a/app/ui/templates/ui/components/dogear_boxes/SpecialDogearLinkBox.html +++ b/app/ui/templates/ui/components/dogear_boxes/SpecialDogearLinkBox.html @@ -5,6 +5,7 @@ - colour: a string; the colour that the box's accents should be (can be hex code or any other CSS compatible colour thing) {% endcomment %} +{% load wagtailcore_tags %}
{{event.title}}
-diff --git a/app/ui/templates/ui/components/icon_svgs/FilterIcon.html b/app/ui/templates/ui/components/icon_svgs/FilterIcon.html new file mode 100644 index 0000000..1aedbb6 --- /dev/null +++ b/app/ui/templates/ui/components/icon_svgs/FilterIcon.html @@ -0,0 +1,3 @@ + diff --git a/app/ui/templates/ui/components/icon_svgs/MapIcon.html b/app/ui/templates/ui/components/icon_svgs/MapIcon.html new file mode 100644 index 0000000..6f8d25c --- /dev/null +++ b/app/ui/templates/ui/components/icon_svgs/MapIcon.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/app/ui/templates/ui/components/icon_svgs/RefreshIcon.html b/app/ui/templates/ui/components/icon_svgs/RefreshIcon.html index d3b9f21..736e5f5 100644 --- a/app/ui/templates/ui/components/icon_svgs/RefreshIcon.html +++ b/app/ui/templates/ui/components/icon_svgs/RefreshIcon.html @@ -2,6 +2,6 @@ ==> PARAMETERS - class: string; the classes you want for this icon {% endcomment %} -
diff --git a/app/ui/templates/ui/components/programs/ProgramPreviewBlockBase.html b/app/ui/templates/ui/components/programs/ProgramPreviewBlockBase.html index 5ceab04..b31c423 100644 --- a/app/ui/templates/ui/components/programs/ProgramPreviewBlockBase.html +++ b/app/ui/templates/ui/components/programs/ProgramPreviewBlockBase.html @@ -3,6 +3,7 @@ - program: An IndividualProgramPage object; the program page to be previewed {% endcomment %} +{% load wagtailcore_tags %} {% load wagtailimages_tags %} {% image program.header_image original as image_p %} @@ -13,7 +14,7 @@
element {% endcomment %} +{% load wagtailcore_tags %}
{{ header }}
- {{ text|safe }} + {{ text|richtext }}
diff --git a/home/templates/home/components/MappingHubsPanel.html b/home/templates/home/components/MappingHubsPanel.html index bd938df..adb7281 100644 --- a/home/templates/home/components/MappingHubsPanel.html +++ b/home/templates/home/components/MappingHubsPanel.html @@ -1,3 +1,4 @@ +{% load wagtailcore_tags %} {% load wagtailimages_tags %} {% image page.mapping_hubs_background original as image_p %} @@ -10,12 +11,12 @@
{{ hub.title }} @@ -52,7 +53,7 @@
diff --git a/home/templatetags/homepage_tags.py b/home/templatetags/homepage_tags.py index cf36d38..0f85288 100644 --- a/home/templatetags/homepage_tags.py +++ b/home/templatetags/homepage_tags.py @@ -2,6 +2,7 @@ from django import template from django.utils.translation import get_language from home.models import HomePage +from django.conf import settings register = template.Library() @@ -30,3 +31,8 @@ def get_navigation(context): navigation = current_page.get_ancestors(inclusive=True).type(HomePage).first().specific.navigation return navigation + + +@register.simple_tag +def get_mapbox_key(): + return settings.MAPBOX_ACCESS_TOKEN diff --git a/hot_osm/settings/base.py b/hot_osm/settings/base.py index 4ea4d20..2dd994a 100644 --- a/hot_osm/settings/base.py +++ b/hot_osm/settings/base.py @@ -53,6 +53,7 @@ "app.misc", "app.partners", "app.tech", + "app.our_work", "search", "users", "utils", @@ -81,6 +82,7 @@ "wagtail_localize.locales", "wagtail_modeladmin", "storages", + "wagtailgeowidget", ] MIDDLEWARE = [ @@ -261,4 +263,11 @@ # Any template in BASE_TEMPLATE_NAMES or any template that extends a template in # BASE_TEMPLATE_NAMES is a "page" and will be rendered as-is without being wrapped. "BASE_TEMPLATE_NAMES": ["patterns/base_page.html"], +} + +MAPBOX_ACCESS_TOKEN = os.getenv("MAPBOX_ACCESS_TOKEN") +GEO_WIDGET_LEAFLET_TILE_LAYER = "https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token=" + MAPBOX_ACCESS_TOKEN + +GEO_WIDGET_LEAFLET_TILE_LAYER_OPTIONS = { + "attribution": '© Mapbox © OpenStreetMap', } \ No newline at end of file diff --git a/hot_osm/templates/base.html b/hot_osm/templates/base.html index 790dad1..66e0903 100644 --- a/hot_osm/templates/base.html +++ b/hot_osm/templates/base.html @@ -43,6 +43,8 @@ + {% block extra_head %} + {% endblock %}