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 %}