Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

udpate 404 and 500 error templates #178

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added static/images/cdh_404.webp
Binary file not shown.
Binary file added static/images/cdh_500.webp
Binary file not shown.
13 changes: 9 additions & 4 deletions templates/404.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{% extends 'error_base.html' %}
{% load static %}
{% load static wagtailcore_tags %}
{# defaults to 404, but pass error code and message for alternate use #}
{% block page-title %}{{ page_title|default:'Not Found' }}{% endblock %}
{% firstof page_title 'Not Found' as title %}

{% block error-code %}{{ error_code|default:'404' }}{% endblock %}
{% block message %}{{ message|default:"We can’t seem to find the page you’re looking for." }}{% endblock %}
{% block content %}
{% with desc=message|default:"We can't seem to find the page you're looking for." %}
{% with image_src='images/cdh_404.webp' %}
{% include 'includes/error_hero.html' with title='Error 404' description=desc image_src=image_src %}
{% endwith %}
{% endwith %}
{% endblock %}
35 changes: 12 additions & 23 deletions templates/500.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
{% load static wagtailuserbar wagtailcore_tags wagtailimages_tags %}
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<title>Error 500</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<script type="text/javascript"> window.staticRoot = "{% static 'dist/' %}"; </script>

</head>
<body class="{% block body_class %}{% endblock %}">

<div class="grid-full error-page-content">
<h1>Error 500</h1>
<p>Something went wrong. Please try reloading the page, or <a href="/">return to home</a>.</p>
</div>

{% if SENTRY_DSN_FED %}
<script>Raven.config('{{ SENTRY_DSN_FED }}').install()</script>
{% endif %}
</body>
</html>
{% extends 'error_base.html' %}
{% load static wagtailcore_tags %}
{# defaults to 404, but pass error code and message for alternate use #}
{% firstof page_title 'Not Found' as title %}

{% block content %}
{% with desc=message|default:"Something went wrong. Please try reloading the page, or return to home" %}
{% with image_src='images/cdh_500.webp' %}
{% include 'includes/error_hero.html' with title='Error 500' description=desc %}
{% endwith %}
{% endwith %}
{% endblock %}
11 changes: 5 additions & 6 deletions templates/error_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
{% block page-title %}Error{% endblock %}

{% block main %}
<div class="content-width grid-standard page-layout page-layout--without-sidenav error-page__content">
<div class="page-layout__main-content">
<h1>Error {% block error-code %}{% endblock %}</h1>
<p class="error-page__blurb">{% block message %}{% endblock %}</p>
</div>
</div>

{% block content %}

{% endblock %}

{% endblock %}
18 changes: 18 additions & 0 deletions templates/includes/error_hero.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% load static wagtailcore_tags wagtailimages_tags l10n %}

<div class="standard-hero content-width grid-standard">

<h1 class="standard-hero__title">{{ title }}</h1>
<div class="standard-hero__description">
{% if description %}
{{ description | richtext }}
{% endif %}
</div>

<picture class="standard-hero__img">
<img
src="{% static image_src %}"
alt=""
/>
</picture>
</div>
Loading