Skip to content

Commit

Permalink
Add new global header and footer (#1591)
Browse files Browse the repository at this point in the history
Co-authored-by: jamesbiggs <[email protected]>
  • Loading branch information
ahosgood and jamesbiggs authored Sep 17, 2024
1 parent b14e980 commit a516509
Show file tree
Hide file tree
Showing 11 changed files with 291 additions and 272 deletions.
2 changes: 2 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@

ROOT_URLCONF = "config.urls"

ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "").split(",")

TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
Expand Down
5 changes: 2 additions & 3 deletions config/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
}

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "@6gce61jt^(pyj5+l**&*_#zyxfj5v1*71cs5yoetg-!fsz826"
SECRET_KEY = "abc123"

# SECURITY WARNING: define the correct hosts in production!
ALLOWED_HOSTS = ["*"]
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "*").split(",")

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

Expand Down
11 changes: 1 addition & 10 deletions config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,10 @@
from .base import * # noqa: F401

# TODO: Temporary until the static files can be served via S3 or a CDN
DEBUG = True
# DEBUG = True

# TODO: Ensure that certificates are always checked by the Client API in production
# CLIENT_VERIFY_CERTIFICATES = True

# TODO: Generate SECRET_KEY
SECRET_KEY = os.getenv("SECRET_KEY", "")
# Need to get the IP of the load balancer or reverse proxy
ALLOWED_HOSTS = ["*"]
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
STATIC_ROOT = "/app/static"

try:
from .local import * # noqa: F401
except ImportError:
pass
2 changes: 1 addition & 1 deletion config/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
pass

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "@6gce61jt^(pyj5+l**&*_#zyxfj5v1*71cs5yoetg-!fsz826"
SECRET_KEY = "abc123"

ALLOWED_HOSTS = ["localhost", "127.0.0.1"]

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"webpack-cli": "~5.1"
},
"dependencies": {
"@nationalarchives/frontend": "0.1.43",
"@nationalarchives/frontend": "0.1.50",
"jquery": "~3.7",
"openseadragon": "~4.1"
},
Expand Down
2 changes: 2 additions & 0 deletions scripts/src/all.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { initAll } from "../../node_modules/@nationalarchives/frontend/nationalarchives/all.mjs";
import { GA4 } from "../../node_modules/@nationalarchives/frontend/nationalarchives/analytics.mjs";

initAll();
new GA4({ addTrackingCode: false });
27 changes: 13 additions & 14 deletions templates/includes/content-warning.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{% load wagtailcore_tags %}
<div class="tna-message">
<svg class="tna-message__icon" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true" viewBox="0 0 34 34" width="40" height="40">
<path fill="currentColor" d="M15.33 8.67h3.34V12h-3.34V8.67Zm0 6.66h3.34v10h-3.34v-10ZM17 .33a16.67 16.67 0 1 0 .01 33.35A16.67 16.67 0 0 0 17 .33Zm0 30A13.35 13.35 0 0 1 3.67 17C3.67 9.65 9.65 3.67 17 3.67S30.33 9.65 30.33 17 24.35 30.33 17 30.33Z"></path>
</svg>
{% if custom_warning_text %}
<div class="tna-message__message">
{{ custom_warning_text | richtext }}
</div>
{% else %}
<p class="tna-message__message">
This article contains content that some people may find offensive.
</p>
{% endif %}
</div>
<div class="tna-warning">
<h2 class="tna-warning__heading tna-visually-hidden">
Important information
</h2>
<span class="tna-warning__heading-icon" aria-hidden="true">!</span>
<div class="tna-warning__body">
{% if custom_warning_text %}
{{ custom_warning_text | richtext }}
{% else %}
This article contains content that some people may find offensive.
{% endif %}
</div>
</div>
411 changes: 212 additions & 199 deletions templates/includes/footer.html

Large diffs are not rendered by default.

93 changes: 53 additions & 40 deletions templates/includes/header.html
Original file line number Diff line number Diff line change
@@ -1,56 +1,69 @@
{% load static robots_meta %}

{% include 'includes/login-status.html' %}

<header class="tna-header {{ classes }}" data-module="tna-header">
<div class="tna-header__exit">
<div class="tna-container">
<div class="tna-column tna-column--full">
<a href="https://www.nationalarchives.gov.uk/" class="tna-header__exit-link" target="_blank" data-component-name="Banner" data-link-type="Link text" data-link="Go to the current National Archives website">
Go to the current National Archives website<span class="tna-visually-hidden"> (opens in a new tab)</span><i class="fa-solid fa-arrow-up-right-from-square"></i>
</a>
</div>
</div>
</div>
<div class="tna-container tna-header__contents">
<div class="tna-column tna-header__logo">
<a href="/" class="tna-header__logo-link tna-header__logo-link--href">
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" class="tna-logo" style="enable-background:new 0 0 160 160" viewBox="0 0 160 160" width="96" height="96">
<header class="tna-global-header" data-module="tna-global-header">
<div class="tna-container tna-global-header__main">
<div class="tna-column tna-column--flex-1 tna-column--order-2">
<span class="tna-global-header__logo-wrapper">
<a href="https://www.nationalarchives.gov.uk/" class="tna-global-header__logo" title="The National Archives">
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" class="tna-logo" viewBox="0 0 160 160" width="96" height="96">
<title>The National Archives</title>
<path fill="transparent" d="M0 0h160v160H0z" class="tna-logo__background" />
<g class="tna-logo__foreground" fill="currentColor">
<path d="M1.9 107.2h156.3V158H1.9v-50.8zm0-52.7h156.3v50.8H1.9V54.5zm0-52.6h77.2v50.8H1.9V1.9zm79 0h77.2v50.8H80.9V1.9zm0-1.9H0v160h160V0H80.9z" />
<path d="M21.3 19.5h-5.4v-3h14.3v3h-5.4v18.4h-3.5zM31.6 16.5H35v9h8.4v-9h3.4v21.4h-3.4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beta</span></a>
</svg>
</a>
</span>
</div>
<div class="tna-column tna-header__navigation-toggle">
<button class="tna-header__navigation-toggle-button" type="button" aria-controls="tna-header__navigation" hidden>
<div class="tna-column tna-column--order-2 tna-global-header__navigation-button-wrapper">
<button class="tna-global-header__navigation-button" type="button" aria-controls="tna-header__navigation tna-header__top-navigation" hidden>
Menu
<span class="tna-header__hamburger"></span>
<span class="tna-global-header__hamburger"></span>
</button>
</div>
{% if settings.core.SiteSettings.main_menu_items %}
<nav class="tna-column tna-column--flex-1 tna-column--full-small tna-column--full-tiny tna-header__navigation" id="tna-header__navigation" aria-label="Main site navigation">
<menu class="tna-header__navigation-items">
{% if request.path|is_search_or_catalogue %}
<!-- FOR PRIVATE BETA: STATIC SEARCH LINK ONLY -->
<li class="tna-header__navigation-item">
<a href="/search/" class="tna-header__navigation-item-link tna-header__navigation-item-link--selected">
Search
</a>
</li>
{% else %}
{% for item in settings.core.SiteSettings.main_menu_items %}
<li class="tna-header__navigation-item">
<a href="{{ item.url }}" class="tna-header__navigation-item-link{% if item.is_active %} tna-header__navigation-item-link--selected{% endif %}" tabindex="0" aria-current="true">
{{ item.label }}
</a>
</li>
{% endfor %}
{% endif %}
</menu>
<nav class="tna-column tna-column--full-small tna-column--full-tiny tna-column--order-3 tna-global-header__navigation-wrapper" id="tna-header__navigation" aria-label="Primary">
<ul class="tna-global-header__navigation">
<li class="tna-global-header__navigation-item">
<a href="https://www.nationalarchives.gov.uk/about/visit-us/" class="tna-global-header__navigation-item-link" tabindex="0">Visit</a>
</li>
<li class="tna-global-header__navigation-item">
<a href="https://www.nationalarchives.gov.uk/about/visit-us/whats-on/" class="tna-global-header__navigation-item-link" tabindex="0">What’s on</a>
</li>
<li class="tna-global-header__navigation-item">
<a href="/explore-the-collection/" class="tna-global-header__navigation-item-link" tabindex="0">Explore the collection</a>
</li>
<li class="tna-global-header__navigation-item">
<a href="https://www.nationalarchives.gov.uk/help-with-your-research/" class="tna-global-header__navigation-item-link" tabindex="0">Help using the archive</a>
</li>
<li class="tna-global-header__navigation-item">
<a href="https://www.nationalarchives.gov.uk/education/" class="tna-global-header__navigation-item-link" tabindex="0">Education</a>
</li>
<li class="tna-global-header__navigation-item">
<a href="https://www.nationalarchives.gov.uk/professional-guidance-and-services/" class="tna-global-header__navigation-item-link" tabindex="0">Professional guidance and services</a>
</li>
</ul>
</nav>
<nav class="tna-column tna-column--full tna-column--order-1 tna-column--order-4-small tna-column--order-4-tiny tna-global-header__top-navigation-wrapper" id="tna-header__top-navigation" aria-label="Secondary">
<ul class="tna-global-header__top-navigation">
<li class="tna-global-header__top-navigation-item">
<a href="https://www.nationalarchives.gov.uk/search/" class="tna-global-header__top-navigation-link" tabindex="0">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
<path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z" />
</svg>
Search
</a>
</li>
<li class="tna-global-header__top-navigation-item">
<a href="https://shop.nationalarchives.gov.uk/" class="tna-global-header__top-navigation-link" tabindex="0">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
<path d="M160 112c0-35.3 28.7-64 64-64s64 28.7 64 64v48H160V112zm-48 48H48c-26.5 0-48 21.5-48 48V416c0 53 43 96 96 96H352c53 0 96-43 96-96V208c0-26.5-21.5-48-48-48H336V112C336 50.1 285.9 0 224 0S112 50.1 112 112v48zm24 48a24 24 0 1 1 0 48 24 24 0 1 1 0-48zm152 24a24 24 0 1 1 48 0 24 24 0 1 1 -48 0z" />
</svg>
Shop
</a>
</li>
</ul>
</nav>
{% endif %}
</div>
</header>

0 comments on commit a516509

Please sign in to comment.