From 4869b47d5307e4dc45526b6b0704cf9dd4f1b341 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 5 Aug 2022 09:25:30 +0100 Subject: [PATCH] Restructure base templates to pull hero into base and remove duplication --- .../blog/blog_collection_list_page.html | 14 +---- .../templates/blog/blog_collection_page.html | 14 +---- .../blog/templates/blog/blog_list_page.html | 16 ++---- .../blog/templates/blog/blog_post_page.html | 4 ++ .../blog/blog_post_tag_list_page.html | 16 ++---- .../templates/blog/blog_post_tag_page.html | 16 ++---- website/common/templates/base.html | 2 +- .../common/templates/common/content_page.html | 14 ++--- website/common/templates/common/hero.html | 46 ---------------- .../common/templates/common/listing_page.html | 16 ++---- website/common/templates/wagtail_base.html | 53 +++++++++++++++++++ .../templates/contact/contact_page.html | 11 +--- .../search/templates/search/search_page.html | 15 ++---- 13 files changed, 84 insertions(+), 153 deletions(-) delete mode 100644 website/common/templates/common/hero.html diff --git a/website/blog/templates/blog/blog_collection_list_page.html b/website/blog/templates/blog/blog_collection_list_page.html index 841a414..ea82377 100644 --- a/website/blog/templates/blog/blog_collection_list_page.html +++ b/website/blog/templates/blog/blog_collection_list_page.html @@ -1,19 +1,9 @@ -{% extends "wagtail_base.html" %} - -{% block content %} - - {% include "common/hero.html" %} - - {% if page.body_html %} -
- {{ page.body_html|safe }} -
- {% endif %} +{% extends "common/content_page.html" %} +{% block post_content %}
{% for collection in collections %} {% include "common/listing-item.html" with page=collection %} {% endfor %}
- {% endblock content %} diff --git a/website/blog/templates/blog/blog_collection_page.html b/website/blog/templates/blog/blog_collection_page.html index 9f439cd..066dbc1 100644 --- a/website/blog/templates/blog/blog_collection_page.html +++ b/website/blog/templates/blog/blog_collection_page.html @@ -1,19 +1,9 @@ -{% extends "wagtail_base.html" %} - -{% block content %} - - {% include "common/hero.html" %} - - {% if page.body_html %} -
- {{ page.body_html|safe }} -
- {% endif %} +{% extends "common/content_page.html" %} +{% block post_content %}
{% for page in pages %} {% include "common/listing-item.html" %} {% endfor %}
- {% endblock content %} diff --git a/website/blog/templates/blog/blog_list_page.html b/website/blog/templates/blog/blog_list_page.html index e30a68b..f3a116a 100644 --- a/website/blog/templates/blog/blog_list_page.html +++ b/website/blog/templates/blog/blog_list_page.html @@ -1,15 +1,6 @@ -{% extends "wagtail_base.html" %} - -{% block content %} - - {% include "common/hero.html" %} - - {% if page.body_html %} -
- {{ page.body_html|safe }} -
- {% endif %} +{% extends "common/content_page.html" %} +{% block post_content %}
{% for page in child_pages %} {% if not filtering_by_tag %} @@ -23,5 +14,4 @@ {% include "common/listing-item.html" %} {% endfor %}
- -{% endblock content %} +{% endblock %} diff --git a/website/blog/templates/blog/blog_post_page.html b/website/blog/templates/blog/blog_post_page.html index 1d82e45..6e7d92f 100644 --- a/website/blog/templates/blog/blog_post_page.html +++ b/website/blog/templates/blog/blog_post_page.html @@ -1 +1,5 @@ {% extends "common/content_page.html" %} + +{% block post_content %} + {% include "common/shareon.html" %} +{% endblock %} diff --git a/website/blog/templates/blog/blog_post_tag_list_page.html b/website/blog/templates/blog/blog_post_tag_list_page.html index 0a102be..531b0cc 100644 --- a/website/blog/templates/blog/blog_post_tag_list_page.html +++ b/website/blog/templates/blog/blog_post_tag_list_page.html @@ -1,19 +1,9 @@ -{% extends "wagtail_base.html" %} - -{% block content %} - - {% include "common/hero.html" %} - - {% if page.body_html %} -
- {{ page.body_html|safe }} -
- {% endif %} +{% extends "common/content_page.html" %} +{% block post_content %}
{% for tag in tags %} {% include "common/listing-item.html" with page=tag %} {% endfor %}
- -{% endblock content %} +{% endblock %} diff --git a/website/blog/templates/blog/blog_post_tag_page.html b/website/blog/templates/blog/blog_post_tag_page.html index 9f439cd..06e1c0c 100644 --- a/website/blog/templates/blog/blog_post_tag_page.html +++ b/website/blog/templates/blog/blog_post_tag_page.html @@ -1,19 +1,9 @@ -{% extends "wagtail_base.html" %} - -{% block content %} - - {% include "common/hero.html" %} - - {% if page.body_html %} -
- {{ page.body_html|safe }} -
- {% endif %} +{% extends "common/content_page.html" %} +{% block post_content %}
{% for page in pages %} {% include "common/listing-item.html" %} {% endfor %}
- -{% endblock content %} +{% endblock %} diff --git a/website/common/templates/base.html b/website/common/templates/base.html index c1193d2..e3201be 100644 --- a/website/common/templates/base.html +++ b/website/common/templates/base.html @@ -30,7 +30,7 @@ {% block main %}
- {% block content %}{% endblock %} + {% block main_content %}{% endblock %}
{% endblock %} diff --git a/website/common/templates/common/content_page.html b/website/common/templates/common/content_page.html index 7d953b4..10ecd60 100644 --- a/website/common/templates/common/content_page.html +++ b/website/common/templates/common/content_page.html @@ -3,15 +3,11 @@ {% load static %} {% block content %} - - {% include "common/hero.html" %} - -
- {{ page.body_html|safe }} -
- - {% include "common/shareon.html" %} - + {% if page.body_html %} +
+ {{ page.body_html|safe }} +
+ {% endif %} {% endblock %} {% block extra_css %} diff --git a/website/common/templates/common/hero.html b/website/common/templates/common/hero.html deleted file mode 100644 index 1891bbd..0000000 --- a/website/common/templates/common/hero.html +++ /dev/null @@ -1,46 +0,0 @@ -{% if page.hero_image_url %} - -{% endif %} - -
-
-
-
-
- {% include "common/breadcrumbs.html" with parents=page.get_parent_pages %} -

{{ page.title }}

- {% if page.subtitle %} -

{{ page.subtitle }}

- {% endif %} - - {% include "common/content-details.html" %} -
- -
-
-
-
diff --git a/website/common/templates/common/listing_page.html b/website/common/templates/common/listing_page.html index 032ade4..69e6f4b 100644 --- a/website/common/templates/common/listing_page.html +++ b/website/common/templates/common/listing_page.html @@ -1,19 +1,9 @@ -{% extends "wagtail_base.html" %} - -{% block content %} - - {% include "common/hero.html" %} - - {% if page.body_html %} -
- {{ page.body_html|safe }} -
- {% endif %} +{% extends "common/content_page.html" %} +{% block post_content %}
{% for page in child_pages %} {% include "common/listing-item.html" %} {% endfor %}
- -{% endblock content %} +{% endblock %} diff --git a/website/common/templates/wagtail_base.html b/website/common/templates/wagtail_base.html index 72dec7c..66811cd 100644 --- a/website/common/templates/wagtail_base.html +++ b/website/common/templates/wagtail_base.html @@ -3,3 +3,56 @@ {% block body_class %}{{ page.body_class }}{% endblock %} {% block title %}{% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %}{% endblock %} + +{% block main_content %} + {% if page.hero_image_url %} + + {% endif %} + +
+
+
+
+
+ {% include "common/breadcrumbs.html" with parents=page.get_parent_pages %} +

{{ page.title }}

+ {% if page.subtitle %} +

{{ page.subtitle }}

+ {% endif %} + + {% include "common/content-details.html" %} +
+ +
+
+
+
+ + {% block pre_content %}{% endblock %} + {% block content %}{% endblock %} + {% block post_content %}{% endblock %} +{% endblock %} diff --git a/website/contact/templates/contact/contact_page.html b/website/contact/templates/contact/contact_page.html index 67202bd..25d9b96 100644 --- a/website/contact/templates/contact/contact_page.html +++ b/website/contact/templates/contact/contact_page.html @@ -1,13 +1,6 @@ -{% extends "wagtail_base.html" %} - -{% block content %} - - {% include "common/hero.html" %} - -
- {{ page.body_html|safe }} -
+{% extends "common/content_page.html" %} +{% block post_content %}
{% for account in accounts %}
diff --git a/website/search/templates/search/search_page.html b/website/search/templates/search/search_page.html index c93072f..3453b83 100644 --- a/website/search/templates/search/search_page.html +++ b/website/search/templates/search/search_page.html @@ -1,17 +1,8 @@ -{% extends "wagtail_base.html" %} +{% extends "common/content_page.html" %} {% load static %} -{% block content %} - - {% include "common/hero.html" %} - - {% if page.body_html %} -
- {{ page.body_html|safe }} -
- {% endif %} - +{% block post_content %}

@@ -46,9 +37,9 @@ {% endif %}

- {% endblock %} {% block extra_js %} + {{ block.super }} {% endblock %}