Restructure base templates to pull hero into base and remove duplication

This commit is contained in:
Jake Howard 2022-08-05 09:25:30 +01:00
parent a0e88f0f78
commit 4869b47d53
Signed by: jake
GPG key ID: 57AFB45680EDD477
13 changed files with 84 additions and 153 deletions

View file

@ -1,19 +1,9 @@
{% extends "wagtail_base.html" %} {% extends "common/content_page.html" %}
{% block content %}
{% include "common/hero.html" %}
{% if page.body_html %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% endif %}
{% block post_content %}
<section class="container"> <section class="container">
{% for collection in collections %} {% for collection in collections %}
{% include "common/listing-item.html" with page=collection %} {% include "common/listing-item.html" with page=collection %}
{% endfor %} {% endfor %}
</section> </section>
{% endblock content %} {% endblock content %}

View file

@ -1,19 +1,9 @@
{% extends "wagtail_base.html" %} {% extends "common/content_page.html" %}
{% block content %}
{% include "common/hero.html" %}
{% if page.body_html %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% endif %}
{% block post_content %}
<section class="container"> <section class="container">
{% for page in pages %} {% for page in pages %}
{% include "common/listing-item.html" %} {% include "common/listing-item.html" %}
{% endfor %} {% endfor %}
</section> </section>
{% endblock content %} {% endblock content %}

View file

@ -1,15 +1,6 @@
{% extends "wagtail_base.html" %} {% extends "common/content_page.html" %}
{% block content %}
{% include "common/hero.html" %}
{% if page.body_html %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% endif %}
{% block post_content %}
<section class="container"> <section class="container">
{% for page in child_pages %} {% for page in child_pages %}
{% if not filtering_by_tag %} {% if not filtering_by_tag %}
@ -23,5 +14,4 @@
{% include "common/listing-item.html" %} {% include "common/listing-item.html" %}
{% endfor %} {% endfor %}
</section> </section>
{% endblock %}
{% endblock content %}

View file

@ -1 +1,5 @@
{% extends "common/content_page.html" %} {% extends "common/content_page.html" %}
{% block post_content %}
{% include "common/shareon.html" %}
{% endblock %}

View file

@ -1,19 +1,9 @@
{% extends "wagtail_base.html" %} {% extends "common/content_page.html" %}
{% block content %}
{% include "common/hero.html" %}
{% if page.body_html %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% endif %}
{% block post_content %}
<section class="container"> <section class="container">
{% for tag in tags %} {% for tag in tags %}
{% include "common/listing-item.html" with page=tag %} {% include "common/listing-item.html" with page=tag %}
{% endfor %} {% endfor %}
</section> </section>
{% endblock %}
{% endblock content %}

View file

@ -1,19 +1,9 @@
{% extends "wagtail_base.html" %} {% extends "common/content_page.html" %}
{% block content %}
{% include "common/hero.html" %}
{% if page.body_html %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% endif %}
{% block post_content %}
<section class="container"> <section class="container">
{% for page in pages %} {% for page in pages %}
{% include "common/listing-item.html" %} {% include "common/listing-item.html" %}
{% endfor %} {% endfor %}
</section> </section>
{% endblock %}
{% endblock content %}

View file

@ -30,7 +30,7 @@
{% block main %} {% block main %}
<main> <main>
{% block content %}{% endblock %} {% block main_content %}{% endblock %}
</main> </main>
{% endblock %} {% endblock %}

View file

@ -3,15 +3,11 @@
{% load static %} {% load static %}
{% block content %} {% block content %}
{% if page.body_html %}
{% include "common/hero.html" %}
<section class="container content"> <section class="container content">
{{ page.body_html|safe }} {{ page.body_html|safe }}
</section> </section>
{% endif %}
{% include "common/shareon.html" %}
{% endblock %} {% endblock %}
{% block extra_css %} {% block extra_css %}

View file

@ -1,46 +0,0 @@
{% if page.hero_image_url %}
<img class="hero" src="{{ page.hero_image_url }}">
{% endif %}
<section class="hero">
<div class="container">
<div class="hero-body">
<div class="columns">
<div class="column">
{% include "common/breadcrumbs.html" with parents=page.get_parent_pages %}
<h1 class="title is-spaced">{{ page.title }}</h1>
{% if page.subtitle %}
<h2 class="subtitle">{{ page.subtitle }}</h2>
{% endif %}
{% include "common/content-details.html" %}
</div>
<div class="column is-narrow dropdown-wrapper is-hidden-touch is-grouped">
{% if page.table_of_contents %}
<div class="dropdown is-hoverable is-right" id="table-of-contents">
<div class="dropdown-trigger">
<button class="button is-radiusless" aria-haspopup="true" aria-controls="toc-menu">
<span>Table of Contents</span>
<span class="icon is-small">
<i class="fas fa-angle-down" aria-hidden="true"></i>
</span>
</button>
</div>
<div class="dropdown-menu" id="toc-menu" role="menu">
<div class="dropdown-content menu">
<ul class="menu-list">
{% for toc_item in page.table_of_contents %}
{% include "common/toc-item.html" %}
{% endfor %}
</ul>
</div>
</div>
</div>
{% endif %}
<button class="button is-radiusless scroll-top">Top <i class="fas fa-angle-up ml-2" aria-hidden="true"></i></button>
</div>
</div>
</div>
</div>
</section>

View file

@ -1,19 +1,9 @@
{% extends "wagtail_base.html" %} {% extends "common/content_page.html" %}
{% block content %}
{% include "common/hero.html" %}
{% if page.body_html %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% endif %}
{% block post_content %}
<section class="container"> <section class="container">
{% for page in child_pages %} {% for page in child_pages %}
{% include "common/listing-item.html" %} {% include "common/listing-item.html" %}
{% endfor %} {% endfor %}
</section> </section>
{% endblock %}
{% endblock content %}

View file

@ -3,3 +3,56 @@
{% block body_class %}{{ page.body_class }}{% endblock %} {% block body_class %}{{ page.body_class }}{% endblock %}
{% block title %}{% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %}{% endblock %} {% block title %}{% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %}{% endblock %}
{% block main_content %}
{% if page.hero_image_url %}
<img class="hero" src="{{ page.hero_image_url }}">
{% endif %}
<section class="hero">
<div class="container">
<div class="hero-body">
<div class="columns">
<div class="column">
{% include "common/breadcrumbs.html" with parents=page.get_parent_pages %}
<h1 class="title is-spaced">{{ page.title }}</h1>
{% if page.subtitle %}
<h2 class="subtitle">{{ page.subtitle }}</h2>
{% endif %}
{% include "common/content-details.html" %}
</div>
<div class="column is-narrow dropdown-wrapper is-hidden-touch is-grouped">
{% if page.table_of_contents %}
<div class="dropdown is-hoverable is-right" id="table-of-contents">
<div class="dropdown-trigger">
<button class="button is-radiusless" aria-haspopup="true" aria-controls="toc-menu">
<span>Table of Contents</span>
<span class="icon is-small">
<i class="fas fa-angle-down" aria-hidden="true"></i>
</span>
</button>
</div>
<div class="dropdown-menu" id="toc-menu" role="menu">
<div class="dropdown-content menu">
<ul class="menu-list">
{% for toc_item in page.table_of_contents %}
{% include "common/toc-item.html" %}
{% endfor %}
</ul>
</div>
</div>
</div>
{% endif %}
<button class="button is-radiusless scroll-top">Top <i class="fas fa-angle-up ml-2" aria-hidden="true"></i></button>
</div>
</div>
</div>
</div>
</section>
{% block pre_content %}{% endblock %}
{% block content %}{% endblock %}
{% block post_content %}{% endblock %}
{% endblock %}

View file

@ -1,13 +1,6 @@
{% extends "wagtail_base.html" %} {% extends "common/content_page.html" %}
{% block content %}
{% include "common/hero.html" %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% block post_content %}
<section class="container"> <section class="container">
{% for account in accounts %} {% for account in accounts %}
<div class="card mt-4" id="{{ account.slug }}"> <div class="card mt-4" id="{{ account.slug }}">

View file

@ -1,17 +1,8 @@
{% extends "wagtail_base.html" %} {% extends "common/content_page.html" %}
{% load static %} {% load static %}
{% block content %} {% block post_content %}
{% include "common/hero.html" %}
{% if page.body_html %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% endif %}
<section class="container search-controls"> <section class="container search-controls">
<div class="field"> <div class="field">
<p class="control has-icons-left has-icons-right"> <p class="control has-icons-left has-icons-right">
@ -46,9 +37,9 @@
{% endif %} {% endif %}
</div> </div>
</section> </section>
{% endblock %} {% endblock %}
{% block extra_js %} {% block extra_js %}
{{ block.super }}
<script async defer type="text/javascript" src="{% static 'js/search.js' %}"></script> <script async defer type="text/javascript" src="{% static 'js/search.js' %}"></script>
{% endblock %} {% endblock %}