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" %}
{% block content %}
{% include "common/hero.html" %}
{% if page.body_html %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% endif %}
{% extends "common/content_page.html" %}
{% block post_content %}
<section class="container">
{% for collection in collections %}
{% include "common/listing-item.html" with page=collection %}
{% endfor %}
</section>
{% endblock content %}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,15 +3,11 @@
{% load static %}
{% block content %}
{% include "common/hero.html" %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% include "common/shareon.html" %}
{% if page.body_html %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% endif %}
{% endblock %}
{% 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" %}
{% block content %}
{% include "common/hero.html" %}
{% if page.body_html %}
<section class="container content">
{{ page.body_html|safe }}
</section>
{% endif %}
{% extends "common/content_page.html" %}
{% block post_content %}
<section class="container">
{% for page in child_pages %}
{% include "common/listing-item.html" %}
{% endfor %}
</section>
{% endblock content %}
{% endblock %}

View File

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