- {% include 'service_introduction.html' with page=page what_we_do=False %}
-
-
+ {% include 'service_introduction.html' with page=page %}
+
+
+
+ + {{ page.introduction_title }} +
+
+ {{ page.introduction_text|richtext }}
+
+
{% translate "Browse Terms" %}
diff --git a/pages/mediacenter/templates/mediacenter_index.html b/pages/mediacenter/templates/mediacenter_index.html
index 5f5a0c9c..aa2d1d14 100644
--- a/pages/mediacenter/templates/mediacenter_index.html
+++ b/pages/mediacenter/templates/mediacenter_index.html
@@ -1,5 +1,5 @@
{% extends 'services_page_base.html' %}
-{% load static wagtailsettings_tags i18n %}
+{% load static wagtailsettings_tags i18n wagtailcore_tags %}
{% get_settings use_default_site=True %}
{% block extra_css %}
@@ -16,11 +16,24 @@
{% block content %}
{% include 'hero.html' with page=page %}
-
-
- {% include 'service_introduction.html' with page=page %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if settings.base.OrganisationSetting.facebook or settings.base.OrganisationSetting.twitter %}
diff --git a/pages/organisation_pages/partners/templates/partners/partners.html b/pages/organisation_pages/partners/templates/partners/partners.html
index 131794a4..6d2d0d5c 100644
--- a/pages/organisation_pages/partners/templates/partners/partners.html
+++ b/pages/organisation_pages/partners/templates/partners/partners.html
@@ -10,14 +10,25 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
- {% include 'service_introduction.html' with page=page %}
-
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if partners %}
diff --git a/pages/organisation_pages/projects/templates/project_index_page.html b/pages/organisation_pages/projects/templates/project_index_page.html
index 29c274bf..f04ebb4c 100644
--- a/pages/organisation_pages/projects/templates/project_index_page.html
+++ b/pages/organisation_pages/projects/templates/project_index_page.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static i18n %}
+{% load static i18n wagtailcore_tags %}
{% block extra_css %}
@@ -9,13 +9,26 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
- {% include 'service_introduction.html' with page=page %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
+
{% translate "All Projects" %}
diff --git a/pages/organisation_pages/projects/templates/project_page.html b/pages/organisation_pages/projects/templates/project_page.html
index a6649899..19b656d1 100644
--- a/pages/organisation_pages/projects/templates/project_page.html
+++ b/pages/organisation_pages/projects/templates/project_page.html
@@ -15,14 +15,26 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
- {% include 'service_introduction.html' with page=page %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if page.goals_block %}
diff --git a/pages/organisation_pages/tenders/templates/tenders_index_page.html b/pages/organisation_pages/tenders/templates/tenders_index_page.html
index db9515f9..c9e6f308 100644
--- a/pages/organisation_pages/tenders/templates/tenders_index_page.html
+++ b/pages/organisation_pages/tenders/templates/tenders_index_page.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static i18n %}
+{% load static i18n wagtailcore_tags %}
{% block extra_css %}
@@ -9,14 +9,25 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
- {% include 'service_introduction.html' with page=page %}
-
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if tenders %}
diff --git a/pages/organisation_pages/vacancies/templates/vacancies_index_page.html b/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
index a0b39d94..8eda003c 100644
--- a/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
+++ b/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static i18n %}
+{% load static i18n wagtailcore_tags %}
{% block extra_css %}
@@ -9,14 +9,25 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
- {% include 'service_introduction.html' with page=page %}
-
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if vacancies %}
diff --git a/pages/products/blocks.py b/pages/products/blocks.py
index 3ea6326d..6236179f 100644
--- a/pages/products/blocks.py
+++ b/pages/products/blocks.py
@@ -25,12 +25,15 @@ def product_item_type(self):
def product_date_str(self):
return self.get("date").isoformat()
+ @property
def p_image(self):
if self.get("image"):
return self.get("image")
if self.get("thumbnail"):
return self.get("thumbnail")
+ return None
+
class ProductItemTypeBlock(blocks.StructBlock):
name = blocks.CharBlock(label=_("Name"))
diff --git a/pages/products/migrations/0025_productpage_default_listing_thumbnail.py b/pages/products/migrations/0025_productpage_default_listing_thumbnail.py
new file mode 100644
index 00000000..81c8adcb
--- /dev/null
+++ b/pages/products/migrations/0025_productpage_default_listing_thumbnail.py
@@ -0,0 +1,20 @@
+# Generated by Django 4.2.7 on 2024-07-01 11:04
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('wagtailimages', '0025_alter_image_file_alter_rendition_file'),
+ ('products', '0024_alter_productitempage_products'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='productpage',
+ name='default_listing_thumbnail',
+ field=models.ForeignKey(blank=True, help_text='An image that will be used as a thumbnail for in the products listing, if no image can be extracted from product items', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Default Listing Thumbnail'),
+ ),
+ ]
diff --git a/pages/products/models.py b/pages/products/models.py
index 162cc214..070c380c 100644
--- a/pages/products/models.py
+++ b/pages/products/models.py
@@ -130,6 +130,17 @@ class ProductPage(AbstractIntroPage):
], help_text=_("How many of this products should be visible on the landing page filter section ?"),
verbose_name=_("Products per page"))
+ default_listing_thumbnail = models.ForeignKey(
+ 'wagtailimages.Image',
+ verbose_name=_("Default Listing Thumbnail"),
+ help_text=_("An image that will be used as a thumbnail for in the products listing, "
+ "if no image can be extracted from product items"),
+ null=True,
+ blank=True,
+ on_delete=models.SET_NULL,
+ related_name='+',
+ )
+
map_layers = StreamField([
('layers', LayerBlock(label="Layer"))
], blank=True, null=True, use_json_field=True, verbose_name=_("Map Layers"))
@@ -142,6 +153,7 @@ class ProductPage(AbstractIntroPage):
MultiFieldPanel(
[
FieldPanel('products_per_page'),
+ FieldPanel('default_listing_thumbnail'),
],
heading=_("Other settings"),
),
@@ -327,3 +339,12 @@ def get_context(self, request, *args, **kwargs):
def product_category(self):
parent = self.get_parent().specific
return parent.product.name
+
+ @property
+ def products_listing_image(self):
+ products = self.products
+ for product in products:
+ if product.value.p_image:
+ return product.value.p_image
+
+ return None
diff --git a/pages/products/templates/products/product_index.html b/pages/products/templates/products/product_index.html
index c082ad60..efac4a5c 100644
--- a/pages/products/templates/products/product_index.html
+++ b/pages/products/templates/products/product_index.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static wagtailiconchooser_tags i18n %}
+{% load static wagtailiconchooser_tags i18n wagtailcore_tags %}
{% block extra_css %}
{% if page.map_layers %}
@@ -14,11 +14,24 @@
{% block content %}
-
-
- {% include 'service_introduction.html' with page=page what_we_do=False %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page what_we_do=False %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if page.map_layers %}
@@ -63,10 +76,10 @@
{% include "products/products_map_include.html" with layers=page.map_layers_list %}
-
+
{% endblock content %}
diff --git a/pages/products/templates/products/product_list_include.html b/pages/products/templates/products/product_list_include.html
index 9f7bacb4..78dc40aa 100644
--- a/pages/products/templates/products/product_list_include.html
+++ b/pages/products/templates/products/product_list_include.html
@@ -19,15 +19,20 @@
-
{% if products %}
{% for product in products %}
-
{% endif %}
{% if page.what_we_do_items %}
-
- {% include 'what_we_do_section.html' with page=page %}
+
+
+
+ {% translate "What we do" %}
+
+
+
+ {% for block in page.what_we_do_items %}
+
+
+
+ {% if block.value.icon %}
+
+ {% svg_icon name=block.value.icon %}
+
+ {% endif %}
+
+ {{ block.value.title }}
+
+
+
+
+
+
+
+
+ {{ block.value.description|richtext }}
+
+
+
+ {% endfor %}
+
+ {% if page.what_we_do_button_text and page.what_we_do_button_link %}
+
+ {% endif %}
+
{% endif %}
@@ -96,7 +149,6 @@
{% endif %}
-
{% if page.events.all %}
diff --git a/pages/weather/models.py b/pages/weather/models.py
index fa25d7da..2d39dfbf 100644
--- a/pages/weather/models.py
+++ b/pages/weather/models.py
@@ -65,7 +65,9 @@ def forecast_for_city(self, request, city_slug=None):
return self.render(request, context_overrides=context_overrides)
- detail_data = get_city_forecast_detail_data(city, request)
+ forecast_periods_count = fm_settings.periods.count()
+ multi_period = forecast_periods_count > 1
+ detail_data = get_city_forecast_detail_data(city, multi_period=multi_period, request=request)
context_overrides.update({
"city": city,
diff --git a/pages/weather/templates/weather/daily_weather_report_index.html b/pages/weather/templates/weather/daily_weather_report_index.html
index 97b31a57..5a9e6220 100644
--- a/pages/weather/templates/weather/daily_weather_report_index.html
+++ b/pages/weather/templates/weather/daily_weather_report_index.html
@@ -1,15 +1,28 @@
{% extends "base.html" %}
-{% load static wagtailimages_tags i18n %}
+{% load static wagtailimages_tags i18n wagtailcore_tags %}
{% block body_class %}weather{% endblock %}
{% block content %}
-
-
- {% include 'service_introduction.html' with page=page what_we_do=False %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% translate "Browse Updates" %}
@@ -28,8 +41,6 @@
{% endblock content %}
-
-
{% block extra_js %}
- {% include 'service_introduction.html' with page=page %}
-
-
+ {% include 'service_introduction.html' with page=page %}
+
+
+
+ + {{ page.introduction_title }} +
+
+ {{ page.introduction_text|richtext }}
+
+
diff --git a/pages/organisation_pages/partners/templates/partners/partners.html b/pages/organisation_pages/partners/templates/partners/partners.html
index 131794a4..6d2d0d5c 100644
--- a/pages/organisation_pages/partners/templates/partners/partners.html
+++ b/pages/organisation_pages/partners/templates/partners/partners.html
@@ -10,14 +10,25 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
-
+ {% if page.introduction_image %}
+
+
+ {% else %}
+
+
+ {% endif %}
{% if partners %}
- {% include 'service_introduction.html' with page=page %}
-
-
+ {% include 'service_introduction.html' with page=page %}
+
+
+
+ + {{ page.introduction_title }} +
+
+ {{ page.introduction_text|richtext }}
+
+
diff --git a/pages/organisation_pages/projects/templates/project_index_page.html b/pages/organisation_pages/projects/templates/project_index_page.html
index 29c274bf..f04ebb4c 100644
--- a/pages/organisation_pages/projects/templates/project_index_page.html
+++ b/pages/organisation_pages/projects/templates/project_index_page.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static i18n %}
+{% load static i18n wagtailcore_tags %}
{% block extra_css %}
@@ -9,13 +9,26 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% else %}
+
+
+ {% endif %}
+
{% translate "All Projects" %}
diff --git a/pages/organisation_pages/projects/templates/project_page.html b/pages/organisation_pages/projects/templates/project_page.html
index a6649899..19b656d1 100644
--- a/pages/organisation_pages/projects/templates/project_page.html
+++ b/pages/organisation_pages/projects/templates/project_page.html
@@ -15,14 +15,26 @@
{% block content %}
- {% include 'service_introduction.html' with page=page %}
-
-
+ {% include 'service_introduction.html' with page=page %}
+
+
+
+ + {{ page.introduction_title }} +
+
+ {{ page.introduction_text|richtext }}
+
+
{% translate "All Projects" %}
diff --git a/pages/organisation_pages/projects/templates/project_page.html b/pages/organisation_pages/projects/templates/project_page.html
index a6649899..19b656d1 100644
--- a/pages/organisation_pages/projects/templates/project_page.html
+++ b/pages/organisation_pages/projects/templates/project_page.html
@@ -15,14 +15,26 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
- {% include 'service_introduction.html' with page=page %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if page.goals_block %}
diff --git a/pages/organisation_pages/tenders/templates/tenders_index_page.html b/pages/organisation_pages/tenders/templates/tenders_index_page.html
index db9515f9..c9e6f308 100644
--- a/pages/organisation_pages/tenders/templates/tenders_index_page.html
+++ b/pages/organisation_pages/tenders/templates/tenders_index_page.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static i18n %}
+{% load static i18n wagtailcore_tags %}
{% block extra_css %}
@@ -9,14 +9,25 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
- {% include 'service_introduction.html' with page=page %}
-
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if tenders %}
diff --git a/pages/organisation_pages/vacancies/templates/vacancies_index_page.html b/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
index a0b39d94..8eda003c 100644
--- a/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
+++ b/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static i18n %}
+{% load static i18n wagtailcore_tags %}
{% block extra_css %}
@@ -9,14 +9,25 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
- {% include 'service_introduction.html' with page=page %}
-
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if vacancies %}
diff --git a/pages/products/blocks.py b/pages/products/blocks.py
index 3ea6326d..6236179f 100644
--- a/pages/products/blocks.py
+++ b/pages/products/blocks.py
@@ -25,12 +25,15 @@ def product_item_type(self):
def product_date_str(self):
return self.get("date").isoformat()
+ @property
def p_image(self):
if self.get("image"):
return self.get("image")
if self.get("thumbnail"):
return self.get("thumbnail")
+ return None
+
class ProductItemTypeBlock(blocks.StructBlock):
name = blocks.CharBlock(label=_("Name"))
diff --git a/pages/products/migrations/0025_productpage_default_listing_thumbnail.py b/pages/products/migrations/0025_productpage_default_listing_thumbnail.py
new file mode 100644
index 00000000..81c8adcb
--- /dev/null
+++ b/pages/products/migrations/0025_productpage_default_listing_thumbnail.py
@@ -0,0 +1,20 @@
+# Generated by Django 4.2.7 on 2024-07-01 11:04
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('wagtailimages', '0025_alter_image_file_alter_rendition_file'),
+ ('products', '0024_alter_productitempage_products'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='productpage',
+ name='default_listing_thumbnail',
+ field=models.ForeignKey(blank=True, help_text='An image that will be used as a thumbnail for in the products listing, if no image can be extracted from product items', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Default Listing Thumbnail'),
+ ),
+ ]
diff --git a/pages/products/models.py b/pages/products/models.py
index 162cc214..070c380c 100644
--- a/pages/products/models.py
+++ b/pages/products/models.py
@@ -130,6 +130,17 @@ class ProductPage(AbstractIntroPage):
], help_text=_("How many of this products should be visible on the landing page filter section ?"),
verbose_name=_("Products per page"))
+ default_listing_thumbnail = models.ForeignKey(
+ 'wagtailimages.Image',
+ verbose_name=_("Default Listing Thumbnail"),
+ help_text=_("An image that will be used as a thumbnail for in the products listing, "
+ "if no image can be extracted from product items"),
+ null=True,
+ blank=True,
+ on_delete=models.SET_NULL,
+ related_name='+',
+ )
+
map_layers = StreamField([
('layers', LayerBlock(label="Layer"))
], blank=True, null=True, use_json_field=True, verbose_name=_("Map Layers"))
@@ -142,6 +153,7 @@ class ProductPage(AbstractIntroPage):
MultiFieldPanel(
[
FieldPanel('products_per_page'),
+ FieldPanel('default_listing_thumbnail'),
],
heading=_("Other settings"),
),
@@ -327,3 +339,12 @@ def get_context(self, request, *args, **kwargs):
def product_category(self):
parent = self.get_parent().specific
return parent.product.name
+
+ @property
+ def products_listing_image(self):
+ products = self.products
+ for product in products:
+ if product.value.p_image:
+ return product.value.p_image
+
+ return None
diff --git a/pages/products/templates/products/product_index.html b/pages/products/templates/products/product_index.html
index c082ad60..efac4a5c 100644
--- a/pages/products/templates/products/product_index.html
+++ b/pages/products/templates/products/product_index.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static wagtailiconchooser_tags i18n %}
+{% load static wagtailiconchooser_tags i18n wagtailcore_tags %}
{% block extra_css %}
{% if page.map_layers %}
@@ -14,11 +14,24 @@
{% block content %}
-
-
- {% include 'service_introduction.html' with page=page what_we_do=False %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page what_we_do=False %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if page.map_layers %}
@@ -63,10 +76,10 @@
{% include "products/products_map_include.html" with layers=page.map_layers_list %}
-
+
{% endblock content %}
diff --git a/pages/products/templates/products/product_list_include.html b/pages/products/templates/products/product_list_include.html
index 9f7bacb4..78dc40aa 100644
--- a/pages/products/templates/products/product_list_include.html
+++ b/pages/products/templates/products/product_list_include.html
@@ -19,15 +19,20 @@
- {% include 'service_introduction.html' with page=page %}
-
-
+ {% include 'service_introduction.html' with page=page %}
+
+
+
+ + {{ page.introduction_title }} +
+
+ {{ page.introduction_text|richtext }}
+
+
diff --git a/pages/organisation_pages/tenders/templates/tenders_index_page.html b/pages/organisation_pages/tenders/templates/tenders_index_page.html
index db9515f9..c9e6f308 100644
--- a/pages/organisation_pages/tenders/templates/tenders_index_page.html
+++ b/pages/organisation_pages/tenders/templates/tenders_index_page.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static i18n %}
+{% load static i18n wagtailcore_tags %}
{% block extra_css %}
@@ -9,14 +9,25 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
- {% include 'service_introduction.html' with page=page %}
-
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if tenders %}
diff --git a/pages/organisation_pages/vacancies/templates/vacancies_index_page.html b/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
index a0b39d94..8eda003c 100644
--- a/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
+++ b/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static i18n %}
+{% load static i18n wagtailcore_tags %}
{% block extra_css %}
@@ -9,14 +9,25 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
- {% include 'service_introduction.html' with page=page %}
-
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if vacancies %}
diff --git a/pages/products/blocks.py b/pages/products/blocks.py
index 3ea6326d..6236179f 100644
--- a/pages/products/blocks.py
+++ b/pages/products/blocks.py
@@ -25,12 +25,15 @@ def product_item_type(self):
def product_date_str(self):
return self.get("date").isoformat()
+ @property
def p_image(self):
if self.get("image"):
return self.get("image")
if self.get("thumbnail"):
return self.get("thumbnail")
+ return None
+
class ProductItemTypeBlock(blocks.StructBlock):
name = blocks.CharBlock(label=_("Name"))
diff --git a/pages/products/migrations/0025_productpage_default_listing_thumbnail.py b/pages/products/migrations/0025_productpage_default_listing_thumbnail.py
new file mode 100644
index 00000000..81c8adcb
--- /dev/null
+++ b/pages/products/migrations/0025_productpage_default_listing_thumbnail.py
@@ -0,0 +1,20 @@
+# Generated by Django 4.2.7 on 2024-07-01 11:04
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('wagtailimages', '0025_alter_image_file_alter_rendition_file'),
+ ('products', '0024_alter_productitempage_products'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='productpage',
+ name='default_listing_thumbnail',
+ field=models.ForeignKey(blank=True, help_text='An image that will be used as a thumbnail for in the products listing, if no image can be extracted from product items', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Default Listing Thumbnail'),
+ ),
+ ]
diff --git a/pages/products/models.py b/pages/products/models.py
index 162cc214..070c380c 100644
--- a/pages/products/models.py
+++ b/pages/products/models.py
@@ -130,6 +130,17 @@ class ProductPage(AbstractIntroPage):
], help_text=_("How many of this products should be visible on the landing page filter section ?"),
verbose_name=_("Products per page"))
+ default_listing_thumbnail = models.ForeignKey(
+ 'wagtailimages.Image',
+ verbose_name=_("Default Listing Thumbnail"),
+ help_text=_("An image that will be used as a thumbnail for in the products listing, "
+ "if no image can be extracted from product items"),
+ null=True,
+ blank=True,
+ on_delete=models.SET_NULL,
+ related_name='+',
+ )
+
map_layers = StreamField([
('layers', LayerBlock(label="Layer"))
], blank=True, null=True, use_json_field=True, verbose_name=_("Map Layers"))
@@ -142,6 +153,7 @@ class ProductPage(AbstractIntroPage):
MultiFieldPanel(
[
FieldPanel('products_per_page'),
+ FieldPanel('default_listing_thumbnail'),
],
heading=_("Other settings"),
),
@@ -327,3 +339,12 @@ def get_context(self, request, *args, **kwargs):
def product_category(self):
parent = self.get_parent().specific
return parent.product.name
+
+ @property
+ def products_listing_image(self):
+ products = self.products
+ for product in products:
+ if product.value.p_image:
+ return product.value.p_image
+
+ return None
diff --git a/pages/products/templates/products/product_index.html b/pages/products/templates/products/product_index.html
index c082ad60..efac4a5c 100644
--- a/pages/products/templates/products/product_index.html
+++ b/pages/products/templates/products/product_index.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static wagtailiconchooser_tags i18n %}
+{% load static wagtailiconchooser_tags i18n wagtailcore_tags %}
{% block extra_css %}
{% if page.map_layers %}
@@ -14,11 +14,24 @@
{% block content %}
-
-
- {% include 'service_introduction.html' with page=page what_we_do=False %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page what_we_do=False %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% if page.map_layers %}
@@ -63,10 +76,10 @@
{% include "products/products_map_include.html" with layers=page.map_layers_list %}
-
+
{% endblock content %}
diff --git a/pages/products/templates/products/product_list_include.html b/pages/products/templates/products/product_list_include.html
index 9f7bacb4..78dc40aa 100644
--- a/pages/products/templates/products/product_list_include.html
+++ b/pages/products/templates/products/product_list_include.html
@@ -19,15 +19,20 @@
- {% include 'service_introduction.html' with page=page %}
-
-
+ {% include 'service_introduction.html' with page=page %}
+
+
+
+ + {{ page.introduction_title }} +
+
+ {{ page.introduction_text|richtext }}
+
+
{% if tenders %}
diff --git a/pages/organisation_pages/vacancies/templates/vacancies_index_page.html b/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
index a0b39d94..8eda003c 100644
--- a/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
+++ b/pages/organisation_pages/vacancies/templates/vacancies_index_page.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static i18n %}
+{% load static i18n wagtailcore_tags %}
{% block extra_css %}
@@ -9,14 +9,25 @@
{% block content %}
-
{% include 'hero.html' with page=page %}
-
-
-
+ {% if page.introduction_image %}
+
+
+ {% else %}
+
+
+ {% endif %}
+
{% endblock content %}
diff --git a/pages/products/templates/products/product_list_include.html b/pages/products/templates/products/product_list_include.html
index 9f7bacb4..78dc40aa 100644
--- a/pages/products/templates/products/product_list_include.html
+++ b/pages/products/templates/products/product_list_include.html
@@ -19,15 +19,20 @@
- {% include 'service_introduction.html' with page=page %}
-
-
+ {% include 'service_introduction.html' with page=page %}
+
+
+
+ + {{ page.introduction_title }} +
+
+ {{ page.introduction_text|richtext }}
+
+
{% if vacancies %}
diff --git a/pages/products/blocks.py b/pages/products/blocks.py
index 3ea6326d..6236179f 100644
--- a/pages/products/blocks.py
+++ b/pages/products/blocks.py
@@ -25,12 +25,15 @@ def product_item_type(self):
def product_date_str(self):
return self.get("date").isoformat()
+ @property
def p_image(self):
if self.get("image"):
return self.get("image")
if self.get("thumbnail"):
return self.get("thumbnail")
+ return None
+
class ProductItemTypeBlock(blocks.StructBlock):
name = blocks.CharBlock(label=_("Name"))
diff --git a/pages/products/migrations/0025_productpage_default_listing_thumbnail.py b/pages/products/migrations/0025_productpage_default_listing_thumbnail.py
new file mode 100644
index 00000000..81c8adcb
--- /dev/null
+++ b/pages/products/migrations/0025_productpage_default_listing_thumbnail.py
@@ -0,0 +1,20 @@
+# Generated by Django 4.2.7 on 2024-07-01 11:04
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('wagtailimages', '0025_alter_image_file_alter_rendition_file'),
+ ('products', '0024_alter_productitempage_products'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='productpage',
+ name='default_listing_thumbnail',
+ field=models.ForeignKey(blank=True, help_text='An image that will be used as a thumbnail for in the products listing, if no image can be extracted from product items', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Default Listing Thumbnail'),
+ ),
+ ]
diff --git a/pages/products/models.py b/pages/products/models.py
index 162cc214..070c380c 100644
--- a/pages/products/models.py
+++ b/pages/products/models.py
@@ -130,6 +130,17 @@ class ProductPage(AbstractIntroPage):
], help_text=_("How many of this products should be visible on the landing page filter section ?"),
verbose_name=_("Products per page"))
+ default_listing_thumbnail = models.ForeignKey(
+ 'wagtailimages.Image',
+ verbose_name=_("Default Listing Thumbnail"),
+ help_text=_("An image that will be used as a thumbnail for in the products listing, "
+ "if no image can be extracted from product items"),
+ null=True,
+ blank=True,
+ on_delete=models.SET_NULL,
+ related_name='+',
+ )
+
map_layers = StreamField([
('layers', LayerBlock(label="Layer"))
], blank=True, null=True, use_json_field=True, verbose_name=_("Map Layers"))
@@ -142,6 +153,7 @@ class ProductPage(AbstractIntroPage):
MultiFieldPanel(
[
FieldPanel('products_per_page'),
+ FieldPanel('default_listing_thumbnail'),
],
heading=_("Other settings"),
),
@@ -327,3 +339,12 @@ def get_context(self, request, *args, **kwargs):
def product_category(self):
parent = self.get_parent().specific
return parent.product.name
+
+ @property
+ def products_listing_image(self):
+ products = self.products
+ for product in products:
+ if product.value.p_image:
+ return product.value.p_image
+
+ return None
diff --git a/pages/products/templates/products/product_index.html b/pages/products/templates/products/product_index.html
index c082ad60..efac4a5c 100644
--- a/pages/products/templates/products/product_index.html
+++ b/pages/products/templates/products/product_index.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% load static wagtailiconchooser_tags i18n %}
+{% load static wagtailiconchooser_tags i18n wagtailcore_tags %}
{% block extra_css %}
{% if page.map_layers %}
@@ -14,11 +14,24 @@
{% block content %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% else %}
+
+
+ {% endif %}
{% if page.map_layers %}
- {% include 'service_introduction.html' with page=page what_we_do=False %}
-
-
+ {% include 'service_introduction.html' with page=page what_we_do=False %}
+
+
+
+ + {{ page.introduction_title }} +
+
+ {{ page.introduction_text|richtext }}
+
+
@@ -63,10 +76,10 @@
{% include "products/products_map_include.html" with layers=page.map_layers_list %}
-
-
{% if products %}
{% for product in products %}
-
{% endif %}
{% if page.what_we_do_items %}
-
{% endif %}
@@ -96,7 +149,6 @@
{% endif %}
-
{% if page.events.all %}
- {% include 'what_we_do_section.html' with page=page %}
+
+
+
+ {% translate "What we do" %}
+
+
+
+ {% for block in page.what_we_do_items %}
+
+ {% if page.what_we_do_button_text and page.what_we_do_button_link %}
+
+ {% endif %}
+
+
+ {% endfor %}
+
+
+
+ {% if block.value.icon %}
+
+ {% svg_icon name=block.value.icon %}
+
+ {% endif %}
+
+ {{ block.value.title }}
+
+
+
+
+
+
+
+
+ {{ block.value.description|richtext }}
+
+
{% endif %}
-
{% if page.events.all %}
diff --git a/pages/weather/models.py b/pages/weather/models.py
index fa25d7da..2d39dfbf 100644
--- a/pages/weather/models.py
+++ b/pages/weather/models.py
@@ -65,7 +65,9 @@ def forecast_for_city(self, request, city_slug=None):
return self.render(request, context_overrides=context_overrides)
- detail_data = get_city_forecast_detail_data(city, request)
+ forecast_periods_count = fm_settings.periods.count()
+ multi_period = forecast_periods_count > 1
+ detail_data = get_city_forecast_detail_data(city, multi_period=multi_period, request=request)
context_overrides.update({
"city": city,
diff --git a/pages/weather/templates/weather/daily_weather_report_index.html b/pages/weather/templates/weather/daily_weather_report_index.html
index 97b31a57..5a9e6220 100644
--- a/pages/weather/templates/weather/daily_weather_report_index.html
+++ b/pages/weather/templates/weather/daily_weather_report_index.html
@@ -1,15 +1,28 @@
{% extends "base.html" %}
-{% load static wagtailimages_tags i18n %}
+{% load static wagtailimages_tags i18n wagtailcore_tags %}
{% block body_class %}weather{% endblock %}
{% block content %}
-
-
- {% include 'service_introduction.html' with page=page what_we_do=False %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% include 'service_introduction.html' with page=page %}
+
+
+ {% else %}
+
+
+
+ {{ page.introduction_title }}
+
+
+ {{ page.introduction_text|richtext }}
+
+
+
+ {% endif %}
{% translate "Browse Updates" %}
@@ -28,8 +41,6 @@
{% endblock content %}
-
-
{% block extra_js %}
diff --git a/pages/weather/models.py b/pages/weather/models.py
index fa25d7da..2d39dfbf 100644
--- a/pages/weather/models.py
+++ b/pages/weather/models.py
@@ -65,7 +65,9 @@ def forecast_for_city(self, request, city_slug=None):
return self.render(request, context_overrides=context_overrides)
- detail_data = get_city_forecast_detail_data(city, request)
+ forecast_periods_count = fm_settings.periods.count()
+ multi_period = forecast_periods_count > 1
+ detail_data = get_city_forecast_detail_data(city, multi_period=multi_period, request=request)
context_overrides.update({
"city": city,
diff --git a/pages/weather/templates/weather/daily_weather_report_index.html b/pages/weather/templates/weather/daily_weather_report_index.html
index 97b31a57..5a9e6220 100644
--- a/pages/weather/templates/weather/daily_weather_report_index.html
+++ b/pages/weather/templates/weather/daily_weather_report_index.html
@@ -1,15 +1,28 @@
{% extends "base.html" %}
-{% load static wagtailimages_tags i18n %}
+{% load static wagtailimages_tags i18n wagtailcore_tags %}
{% block body_class %}weather{% endblock %}
{% block content %}
-
-
+ {% if page.introduction_image %}
+
+
+ {% else %}
+
+
+ {% endif %}
{% translate "Browse Updates" %}
@@ -28,8 +41,6 @@
{% endblock content %}
-
-
{% block extra_js %}
- {% include 'service_introduction.html' with page=page what_we_do=False %}
-
-
+ {% include 'service_introduction.html' with page=page %}
+
+
+
+ + {{ page.introduction_title }} +
+
+ {{ page.introduction_text|richtext }}
+
+