Skip to content

Commit

Permalink
Ready for CD
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Dec 20, 2023
1 parent 34092d4 commit 683b9be
Show file tree
Hide file tree
Showing 15 changed files with 135 additions and 90 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CD

on:
workflow_dispatch:
push:
branches:
- proof-of-concept

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: axelerant/platformsh-deploy-action@v1
with:
project-id: ${{ secrets.PLATFORM_PROJECT_ID }}
cli-token: ${{ secrets.PLATFORM_CLI_TOKEN }}
environment-name: main
6 changes: 0 additions & 6 deletions app/main/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
from flask import render_template


@bp.route("/")
@cache.cached()
def home():
return render_template("main/home.html")


@bp.route("/accessibility/")
@cache.cached()
def accessibility():
Expand Down
8 changes: 4 additions & 4 deletions app/templates/authors/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
<article>
<header class="tna-container tna-section etna-author-header">
<div class="tna-column tna-column--width-1-4 tna-column--width-1-3-medium tna-column--full-tiny tna-column--order-3 tna-column--order-1-tiny">
<img src="{{ data['teaser_image_square_jpg']['full_url'] }}" alt="{{ data['teaser_image_square_jpg']['alt'] }}" width="{{ data['teaser_image_square_jpg']['width'] }}" height="{{ data['teaser_image_square_jpg']['height'] }}" class="etna-author-image">
<img src="{{ page_data['teaser_image_square_jpg']['full_url'] }}" alt="{{ page_data['teaser_image_square_jpg']['alt'] }}" width="{{ page_data['teaser_image_square_jpg']['width'] }}" height="{{ page_data['teaser_image_square_jpg']['height'] }}" class="etna-author-image">
</div>
<div class="tna-column tna-column--flex-1 tna-column--full-tiny tna-column--order-2 tna-column--align-centre">
<h1 class="tna-heading-xl">
{{ data['title'] }}
{{ page_data['title'] }}
</h1>
<p>{{ data['role'] | safe }}</p>
<p>{{ page_data['role'] | safe }}</p>
</div>
</header>
<hr>
<section class="tna-container tna-container--centred tna-section tna-!--margin-bottom-m">
<div class="tna-column tna-column--width-2-3 tna-column--full-small tna-column--full-tiny">
<h2 class="tna-heading-l">About the author</h2>
{{ data['summary'] | safe }}
{{ page_data['summary'] | safe }}
</div>
</section>
<aside class="tna-background-tint tna-section">
Expand Down
4 changes: 2 additions & 2 deletions app/templates/authors/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<section class="tna-section">
<div class="tna-container">
<div class="tna-column tna-column--width-2-3 tna-column--width-5-6-medium tna-column--full-small tna-column--full-tiny">
<h1 class="tna-heading-xl">{{ data['title'] }}</h1>
{{ data['intro'] | safe }}
<h1 class="tna-heading-xl">{{ page_data['title'] }}</h1>
{{ page_data['intro'] | safe }}
</div>
</div>
<div class="tna-container">
Expand Down
32 changes: 16 additions & 16 deletions app/templates/explore/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@
{%- from 'components/hero/macro.html' import tnaHero -%}
{%- from 'macros/feedback.html' import feedback -%}

{% block pageTitle %}{{ data['title'] }} - {{ super() }}{% endblock %}
{% block pageTitle %}{{ page_data['title'] }} - {{ super() }}{% endblock %}

{% block content %}
<article class="etna-article">
<header class="tna-section">
<div class="tna-container">
<div class="tna-column tna-column--width-2-3 tna-column--width-5-6-medium tna-column--full-small tna-column--full-tiny">
<hgroup class="tna-hgroup-xl">
<p class="tna-hgroup__supertitle">{{ data['meta']['type'] | article_supertitle }}</p>
<h1 class="tna-hgroup__title">{{ data['title'] }}</h1>
<p class="tna-hgroup__supertitle">{{ page_data['meta']['type'] | article_supertitle }}</p>
<h1 class="tna-hgroup__title">{{ page_data['title'] }}</h1>
</hgroup>
{{ data['intro'] | safe }}
{{ page_data['intro'] | safe }}
</div>
</div>
</header>
{% if 'hero_image_jpg' in data %}
{% if 'hero_image_jpg' in page_data %}
{{ tnaHero({
'imageSrc': data['hero_image_jpg']['full_url'],
'imageAlt': data['hero_image_jpg']['alt'],
'imageWidth': data['hero_image_jpg']['width'],
'imageHeight': data['hero_image_jpg']['height'],
'imageCaption': data['hero_image_caption'],
'imageSrc': page_data['hero_image_jpg']['full_url'],
'imageAlt': page_data['hero_image_jpg']['alt'],
'imageWidth': page_data['hero_image_jpg']['width'],
'imageHeight': page_data['hero_image_jpg']['height'],
'imageCaption': page_data['hero_image_caption'],
'imageSources': [
{
'src': data['hero_image_webp_small']['full_url'],
'width': data['hero_image_webp_small']['width'],
'height': data['hero_image_webp_small']['height'],
'src': page_data['hero_image_webp_small']['full_url'],
'width': page_data['hero_image_webp_small']['width'],
'height': page_data['hero_image_webp_small']['height'],
'type': 'image/webp',
'media': '(max-width: 48em)'
}
Expand All @@ -43,14 +43,14 @@ <h1 class="tna-hgroup__title">{{ data['title'] }}</h1>
<section class="tna-section tna-!--padding-top-m">
<div class="tna-container">
<div class="tna-column tna-column--width-1-4 tna-column--width-1-3-medium tna-column--full-small tna-column--full-tiny">
{{ articleSidebar(data['body']) }}
{{ articleSidebar(page_data['body']) }}
</div>
<section class="tna-column tna-column--width-3-4 tna-column--width-2-3-medium tna-column--full-small tna-column--full-tiny etna-article__sections">
{{ articleBlocks(data['body'], get_wagtail_image, get_wagtail_page, get_wagtail_media, WAGTAIL_MEDIA_URL) }}
{{ articleBlocks(page_data['body'], get_wagtail_image, get_wagtail_page, get_wagtail_media, WAGTAIL_MEDIA_URL) }}
</section>
<div class="tna-column tna-column--full tna-!--margin-top-m">
<p>
<small>&quot;{{ data['meta']['type'] | article_supertitle }} {{ data['title'] }}&quot; was first published on <time datetime="{{ data['meta']['first_published_at'] }}">{{ data['meta']['first_published_at'] | pretty_date }}</time>.</small>
<small>&quot;{{ page_data['meta']['type'] | article_supertitle }} {{ page_data['title'] }}&quot; was first published on <time datetime="{{ page_data['meta']['first_published_at'] }}">{{ page_data['meta']['first_published_at'] | pretty_date }}</time>.</small>
</p>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/templates/explore/category-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<section class="tna-section">
<div class="tna-container">
<div class="tna-column tna-column--width-2-3 tna-column--width-5-6-medium tna-column--full-small tna-column--full-tiny">
<h1 class="tna-heading-xl">{{ data['title'] }}</h1>
{{ data['intro'] | safe }}
<h1 class="tna-heading-xl">{{ page_data['title'] }}</h1>
{{ page_data['intro'] | safe }}
</div>
</div>
<div class="tna-container">
Expand Down
12 changes: 6 additions & 6 deletions app/templates/explore/category.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

{% block content %}
{{ tnaHero({
'heading': data['title'],
'body': data['intro'] | safe,
'imageSrc': data['teaser_image_large_jpg']['full_url'],
'imageAlt': data['teaser_image_large_jpg']['alt'],
'imageWidth': data['teaser_image_large_jpg']['width'],
'imageHeight': data['teaser_image_large_jpg']['height']
'heading': page_data['title'],
'body': page_data['intro'] | safe,
'imageSrc': page_data['teaser_image_large_jpg']['full_url'],
'imageAlt': page_data['teaser_image_large_jpg']['alt'],
'imageWidth': page_data['teaser_image_large_jpg']['width'],
'imageHeight': page_data['teaser_image_large_jpg']['height']
}) }}
<section class="tna-section">
<div class="tna-container">
Expand Down
34 changes: 17 additions & 17 deletions app/templates/explore/focused-article.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
<header class="tna-section tna-!--padding-bottom-xl">
<div class="tna-container">
<div class="tna-column tna-column--width-2-3 tna-column--width-5-6-medium tna-column--full-small tna-column--full-tiny">
<h1 class="tna-heading-xl">{{ data['title'] }}</h1>
{% if not data['hero_image_jpg'] %}
{{ data['intro'] | safe }}
<h1 class="tna-heading-xl">{{ page_data['title'] }}</h1>
{% if not page_data['hero_image_jpg'] %}
{{ page_data['intro'] | safe }}
{% endif %}
{% if authors | length %}
{% set authors_list = [] %}
Expand All @@ -42,25 +42,25 @@ <h1 class="tna-heading-xl">{{ data['title'] }}</h1>
</div>
</header>
</div>
{% if data['hero_image_jpg'] %}
{% if page_data['hero_image_jpg'] %}
<div class="etna-background-half-top-contrast">
<div class="tna-container">
<div class="tna-column tna-column--full">
{{ tnaHero({
'imageSrc': data['hero_image_jpg']['full_url'],
'imageAlt': data['hero_image_jpg']['alt'],
'imageWidth': data['hero_image_jpg']['width'],
'imageHeight': data['hero_image_jpg']['height'],
'imageSrc': page_data['hero_image_jpg']['full_url'],
'imageAlt': page_data['hero_image_jpg']['alt'],
'imageWidth': page_data['hero_image_jpg']['width'],
'imageHeight': page_data['hero_image_jpg']['height'],
'imageSources': [
{
'src': data['hero_image_jpg_small']['full_url'],
'src': page_data['hero_image_jpg_small']['full_url'],
'media': "(max-width: 48em)",
'width': data['hero_image_jpg_small']['width'],
'height': data['hero_image_jpg_small']['height'],
'width': page_data['hero_image_jpg_small']['width'],
'height': page_data['hero_image_jpg_small']['height'],
'type': "image/jpeg"
}
],
'imageCaption': data['hero_image_caption'] | safe
'imageCaption': page_data['hero_image_caption'] | safe
}) }}
</div>
</div>
Expand All @@ -69,7 +69,7 @@ <h1 class="tna-heading-xl">{{ data['title'] }}</h1>
<div class="tna-container tna-container--centred">
<div class="tna-column tna-column--width-5-6 tna-column--full-small tna-column--full-tiny">
<div class="tna-large-paragraph">
{{ data['intro'] | safe }}
{{ page_data['intro'] | safe }}
</div>
</div>
</div>
Expand All @@ -78,13 +78,13 @@ <h1 class="tna-heading-xl">{{ data['title'] }}</h1>
<section class="tna-section">
<div class="tna-container tna-container--centred">
<div class="tna-column tna-column--width-3-4 tna-column--width-2-3-medium tna-column--full-small tna-column--full-tiny tna-!--margin-bottom-l etna-article__sections">
{% if data['custom_warning_text'] %}
{% if page_data['custom_warning_text'] %}
{{ tnaMessage({
'message': data['custom_warning_text'] | safe,
'message': page_data['custom_warning_text'] | safe,
'classes': 'tna-!--margin-bottom-l'
}) }}
{% endif %}
{{ articleBlocks(data['body'], get_wagtail_image, get_wagtail_page, get_wagtail_media, WAGTAIL_MEDIA_URL) }}
{{ articleBlocks(page_data['body'], get_wagtail_image, get_wagtail_page, get_wagtail_media, WAGTAIL_MEDIA_URL) }}
</div>
{% if authors | length %}
<div class="tna-column tna-column--width-1-4 tna-column--width-1-3-medium tna-column--full-small tna-column--full-tiny">
Expand All @@ -108,7 +108,7 @@ <h2 class="etna-author-list__heading tna-chip tna-chip--plain">About the author{
{% endif %}
<div class="tna-column tna-column--full tna-!--margin-top-m">
<p>
<small>&quot;{{ data['meta']['type'] | article_supertitle }} {{ data['title'] }}&quot; was first published on <time datetime="{{ data['meta']['first_published_at'] }}">{{ data['meta']['first_published_at'] | pretty_date }}</time>.</small>
<small>&quot;{{ page_data['meta']['type'] | article_supertitle }} {{ page_data['title'] }}&quot; was first published on <time datetime="{{ page_data['meta']['first_published_at'] }}">{{ page_data['meta']['first_published_at'] | pretty_date }}</time>.</small>
</p>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions app/templates/explore/highlight-gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<section class="tna-section">
<div class="tna-container">
<div class="tna-column tna-column--width-2-3 tna-column--width-5-6-medium tna-column--full-small tna-column--full-tiny">
<h1 class="tna-heading-xl">{{ data['title'] }}</h1>
{{ data['intro'] | safe }}
<h1 class="tna-heading-xl">{{ page_data['title'] }}</h1>
{{ page_data['intro'] | safe }}
</div>
</div>
{% if 'hero_image_jpg' in data %}
{% if 'hero_image_jpg' in page_data %}
<p>TODO</p>
<div class="tna-hero">
<figure class="tna-hero__figure">
Expand All @@ -20,12 +20,12 @@ <h1 class="tna-heading-xl">{{ data['title'] }}</h1>
<span class="tna-hero__details-summary-icon">I</span>mage caption
</summary>
<div class="tna-hero__information">
{{ data['hero_image_caption'] | safe }}
{{ page_data['hero_image_caption'] | safe }}
</div>
</details>
</figcaption>
<picture class="tna-hero__image">
<img class="tna-picture__image" width="{{ data['hero_image_jpg']['width'] }}" height="{{ data['hero_image_jpg']['height'] }}" src="{{ data['hero_image_jpg']['full_url'] }}" alt="">
<img class="tna-picture__image" width="{{ page_data['hero_image_jpg']['width'] }}" height="{{ page_data['hero_image_jpg']['height'] }}" src="{{ page_data['hero_image_jpg']['full_url'] }}" alt="">
</picture>
</figure>
</div>
Expand Down
10 changes: 5 additions & 5 deletions app/templates/explore/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<section class="tna-section">
<div class="tna-container">
<div class="tna-column tna-column--width-2-3 tna-column--width-5-6-medium tna-column--full-small tna-column--full-tiny">
<h1 class="tna-heading-xl">{{ data['title'] }}</h1>
{{ data['intro'] | safe }}
<h1 class="tna-heading-xl">{{ page_data['title'] }}</h1>
{{ page_data['intro'] | safe }}
</div>
</div>
{{ tnaIndexGrid({
'title': data['title'],
'title': page_data['title'],
'items': large_cards,
'columns': 2,
'columnsTiny': 1
Expand All @@ -22,8 +22,8 @@ <h1 class="tna-heading-xl">{{ data['title'] }}</h1>
<section class="tna-section">
<div class="tna-container">
<div class="tna-column tna-column--width-2-3 tna-column--width-5-6-medium tna-column--full-small tna-column--full-tiny">
<h2 class="tna-heading-l">{{ data['articles_title'] }}</h2>
<p>{{ data['articles_introduction'] }}</p>
<h2 class="tna-heading-l">{{ page_data['articles_title'] }}</h2>
<p>{{ page_data['articles_introduction'] }}</p>
</div>
<div class="tna-column tna-column--full">
{{ tnaCard({
Expand Down
22 changes: 11 additions & 11 deletions app/templates/explore/record-article.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
<div class="tna-container">
<div class="tna-column tna-column--width-2-3 tna-column--full-small tna-column--full-tiny">
<hgroup class="tna-hgroup-xl">
<p class="tna-hgroup__supertitle">{{ data['meta']['type'] | article_supertitle }}</p>
<h1 class="tna-hgroup__title">{{ data['title'] }}</h1>
<p class="tna-hgroup__supertitle">{{ page_data['meta']['type'] | article_supertitle }}</p>
<h1 class="tna-hgroup__title">{{ page_data['title'] }}</h1>
</hgroup>
{{ data['intro'] | safe }}
{{ page_data['intro'] | safe }}
</div>
<div class="tna-column tna-column--width-1-3 tna-!--hide-on-small tna-!--hide-on-tiny etna-tilted-image-wrapper">
<img src="{{ data['teaser_image_square_jpg']['full_url'] }}" width="{{ data['teaser_image_square_jpg']['width'] }}" height="{{ data['teaser_image_square_jpg']['height'] }}" alt="{{ data['teaser_image_square_jpg']['alt'] }}" class="etna-tilted-image">
<img src="{{ page_data['teaser_image_square_jpg']['full_url'] }}" width="{{ page_data['teaser_image_square_jpg']['width'] }}" height="{{ page_data['teaser_image_square_jpg']['height'] }}" alt="{{ page_data['teaser_image_square_jpg']['alt'] }}" class="etna-tilted-image">
</div>
</div>
</section>
Expand Down Expand Up @@ -105,31 +105,31 @@ <h3 class="tna-heading-l">
<h2 class="tna-heading-l">Why this record matters</h2>
<dl class="tna-dl tna-dl--plain">
<dt>Date</dt>
<dd>{{ data['date_text'] }}</dd>
<dd>{{ page_data['date_text'] }}</dd>
<dt>Catalogue reference</dt>
<dd>
<a class="record-matters__text record-matters__text--bold"
href="https://discovery.nationalarchives.gov.uk/details/r/{{ data['record'] }}">{{ data['record'] }}</a>
href="https://discovery.nationalarchives.gov.uk/details/r/{{ page_data['record'] }}">{{ page_data['record'] }}</a>
</dd>
</dl>
{{ data['about'] | safe }}
{{ page_data['about'] | safe }}
<div class="tna-button-group tna-button-group--full">
{{ tnaButton({
'text': 'View record details',
'href': 'https://discovery.nationalarchives.gov.uk/details/r/' + data['record'],
'href': 'https://discovery.nationalarchives.gov.uk/details/r/' + page_data['record'],
'accent': True
}) }}
</div>
</div>
</div>
</section>
{% if data['promoted_links'] | length %}
{% if page_data['promoted_links'] | length %}
<section class="tna-section">
<div class="tna-container">
<div class="tna-column tna-column--full">
<h2 class="tna-heading-l">{{ data['promoted_links'][0]['value']['heading'] }}</h2>
<h2 class="tna-heading-l">{{ page_data['promoted_links'][0]['value']['heading'] }}</h2>
</div>
{% for page in data['promoted_links'][0]['value']['promoted_items'] %}
{% for page in page_data['promoted_links'][0]['value']['promoted_items'] %}
{% with image = get_wagtail_image(page['teaser_image']) %}
<div class="tna-column tna-column--width-1-3 tna-column--width-1-2-medium tna-column--width-1-2-small tna-column--full-tiny">
{# TODO imageSrc #}
Expand Down
10 changes: 5 additions & 5 deletions app/templates/explore/stories.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<section class="tna-section">
<div class="tna-container">
<div class="tna-column tna-column--width-2-3 tna-column--width-5-6-medium tna-column--full-small tna-column--full-tiny">
<h1 class="tna-heading-xl">{{ data['title'] }}</h1>
{{ data['intro'] | safe }}
<h1 class="tna-heading-xl">{{ page_data['title'] }}</h1>
{{ page_data['intro'] | safe }}
</div>
</div>
<div class="tna-container">
Expand All @@ -26,7 +26,7 @@ <h1 class="tna-heading-xl">{{ data['title'] }}</h1>
'imageHeight': featured_article['teaser_image_jpg']['height'],
'actions': [
{
'text': 'Read about ' + data["featured_article"]["title"],
'text': 'Read about ' + page_data["featured_article"]["title"],
'href': featured_article['meta']['html_url']
}
],
Expand All @@ -42,8 +42,8 @@ <h1 class="tna-heading-xl">{{ data['title'] }}</h1>
<section class="tna-section">
<div class="tna-container">
<div class="tna-column tna-column--width-2-3 tna-column--width-5-6-medium tna-column--full-small tna-column--full-tiny">
<h2 class="tna-heading-l">{{ data['featured_pages'][0]['value']['heading'] }}</h2>
<p>{{ data['featured_pages'][0]['value']['description'] }}</p>
<h2 class="tna-heading-l">{{ page_data['featured_pages'][0]['value']['heading'] }}</h2>
<p>{{ page_data['featured_pages'][0]['value']['description'] }}</p>
</div>
</div>
<div class="tna-container">
Expand Down
Loading

0 comments on commit 683b9be

Please sign in to comment.