Skip to content

Commit

Permalink
Merge pull request #168 from alphagov/ldeb-use-digitalmarketplace-gov…
Browse files Browse the repository at this point in the history
…uk-frontend-error-pages

Use Digital Marketplace GOV.UK Template error pages
  • Loading branch information
lfdebrux committed Nov 6, 2019
2 parents 6481f4d + 2d74c13 commit a481aef
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 31 deletions.
6 changes: 6 additions & 0 deletions app/templates/_base_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
{% from "components/breadcrumbs/macro.njk" import govukBreadcrumbs %}
{% from "components/button/macro.njk" import govukButton %}

{# TODO: Remove once we start removing govuk_template, GOV.UK Frontend template uses pageTitle #}
{% block page_title %}{% block pageTitle %}{% endblock %}{% endblock %}

{# override content block to add a beforeContent block like the one in govuk-frontend template #}
{% block content %}
{% block top_header %}{% endblock %}
Expand All @@ -13,7 +16,10 @@
{% endblock %}
<main id="content" role="main">
{% include "toolkit/flash_messages.html" %}
{# TODO: Remove this block when we start removing govuk_template but be sure #}
{# To keep the inner block mainContent otherwise no content will be rendered #}
{% block main_content %}
{% block mainContent %}{% endblock %}
{% endblock %}
</main>
</div>
Expand Down
7 changes: 5 additions & 2 deletions app/templates/briefs/_base_edit_question_page.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{% extends "_base_page.html" %}
{% import "toolkit/forms/macros/forms.html" as forms %}

{% block page_title %}{{ question.question }} – Digital Marketplace{% endblock %}
{% block pageTitle %}
{{ question.question }} – Digital Marketplace
{% endblock %}

{% block mainContent %}

{% block main_content %}
{% include 'toolkit/forms/validation.html' %}

{% if question.type != 'multiquestion' %}
Expand Down
7 changes: 5 additions & 2 deletions app/templates/briefs/application_submitted.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "_base_page.html" %}

{% block page_title %}Your response to ‘{{ brief.title }}’ - Digital Marketplace{% endblock %}
{% block pageTitle %}
Your response to ‘{{ brief.title }}’ - Digital Marketplace
{% endblock %}

{% block breadcrumb %}

Expand All @@ -27,7 +29,8 @@

{% endblock %}

{% block main_content %}
{% block mainContent %}

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">

Expand Down
7 changes: 5 additions & 2 deletions app/templates/briefs/check_your_answers.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "_base_page.html" %}

{% block page_title %}Your response to ‘{{ brief.title }}’ - Digital Marketplace{% endblock %}
{% block pageTitle %}
Your response to ‘{{ brief.title }}’ - Digital Marketplace
{% endblock %}

{% block breadcrumb %}

Expand Down Expand Up @@ -31,7 +33,8 @@

{% endblock %}

{% block main_content %}
{% block mainContent %}

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">
Expand Down
7 changes: 5 additions & 2 deletions app/templates/briefs/clarification_question.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "_base_page.html" %}

{% block page_title %}Ask a question about ‘{{ brief.title }}’ – Digital Marketplace{% endblock %}
{% block pageTitle %}
Ask a question about ‘{{ brief.title }}’ – Digital Marketplace
{% endblock %}

{% block breadcrumb %}

Expand All @@ -23,7 +25,8 @@

{% endblock %}

{% block main_content %}
{% block mainContent %}

{% with lede = "There was a problem with your submitted question" %}
{% include "toolkit/forms/validation.html" %}
{% endwith %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% extends "_base_page.html" %}

{% block page_title %}Not eligible for opportunity – Digital Marketplace{% endblock %}
{% block pageTitle %}
Not eligible for opportunity – Digital Marketplace
{% endblock %}

{% block main_content %}
{% block mainContent %}

{% with inhibited_action="ask a question about" if clarification_question else "apply for" %}
<div class="govuk-grid-row" data-reason="{{ data_reason_slug }}">
Expand Down
6 changes: 4 additions & 2 deletions app/templates/briefs/question_and_answer_session.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "_base_page.html" %}

{% block page_title %}‘{{ brief.title }}’ question and answer session details – Digital Marketplace{% endblock %}
{% block pageTitle %}
‘{{ brief.title }}’ question and answer session details – Digital Marketplace
{% endblock %}

{% block breadcrumb %}

Expand All @@ -23,7 +25,7 @@

{% endblock %}

{% block main_content %}
{% block mainContent %}

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
6 changes: 4 additions & 2 deletions app/templates/briefs/start_brief_response.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "_base_page.html" %}

{% block page_title %}Apply for ‘{{ brief.title }}’ – Digital Marketplace{% endblock %}
{% block pageTitle %}
Apply for ‘{{ brief.title }}’ – Digital Marketplace
{% endblock %}

{% block breadcrumb %}

Expand All @@ -27,7 +29,7 @@

{% endblock %}

{% block main_content %}
{% block mainContent %}

{%
set lot_content = {
Expand Down
7 changes: 5 additions & 2 deletions app/templates/frameworks/opportunities_dashboard.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{% extends "_base_page.html" %}
{% import "toolkit/summary-table.html" as summary %}
{% block page_title %}Opportunities Overview - Digital Marketplace{% endblock %}

{% block pageTitle %}
Opportunities Overview - Digital Marketplace
{% endblock %}

{% block breadcrumb %}

Expand All @@ -22,7 +25,7 @@

{% endblock %}

{% block main_content %}
{% block mainContent %}

<div class="govuk-grid-row">

Expand Down
6 changes: 4 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ class Config(object):
@staticmethod
def init_app(app):
repo_root = os.path.abspath(os.path.dirname(__file__))
digitalmarketplace_govuk_frontend = os.path.join(repo_root, "node_modules", "digitalmarketplace-govuk-frontend")
template_folders = [
os.path.join(repo_root, 'app', 'templates'),
os.path.join(repo_root, 'node_modules', 'digitalmarketplace-govuk-frontend', 'govuk-frontend'),
os.path.join(repo_root, "app", "templates"),
os.path.join(digitalmarketplace_govuk_frontend, "digitalmarketplace", "templates"),
os.path.join(digitalmarketplace_govuk_frontend, "govuk-frontend"),
]
jinja_loader = jinja2.FileSystemLoader(template_folders)
app.jinja_loader = jinja_loader
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"version": "1.0.0",
"private": true,
"engines": {
"node": "^ 10.15"
"node": "^10.16.3"
},
"dependencies": {
"colors": "1.1.2",
"del": "^5.1.0",
"digitalmarketplace-frameworks": "https://github.com/alphagov/digitalmarketplace-frameworks.git#v16.0.10",
"digitalmarketplace-frontend-toolkit": "https://github.com/alphagov/digitalmarketplace-frontend-toolkit.git#v35.0.1",
"digitalmarketplace-govuk-frontend": "^0.1.0",
"digitalmarketplace-govuk-frontend": "^0.2.1",
"govuk-elements-sass": "3.0.3",
"govuk_frontend_toolkit": "5.0.3",
"govuk_template": "https://github.com/alphagov/govuk_template/releases/download/v0.19.2/jinja_govuk_template-0.19.2.tgz",
Expand Down
21 changes: 13 additions & 8 deletions tests/app/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,20 @@ def test_400(self, get_brief):
assert "Please do not attempt the same request again." in res.get_data(as_text=True)

def test_404(self):
res = self.client.get('/service/1234')
res = self.client.get("/service/1234")
assert res.status_code == 404
assert u"Check you’ve entered the correct web " \
u"address or start again on the Digital Marketplace homepage." in res.get_data(as_text=True)
assert u"If you can’t find what you’re looking for, contact us at " \
u"<a href=\"mailto:cloud_digital@crowncommercial.gov.uk?" \
u"subject=Digital%20Marketplace%20feedback\" title=\"Please " \
u"send feedback to cloud_digital@crowncommercial.gov.uk\">" \
u"cloud_digital@crowncommercial.gov.uk</a>" in res.get_data(as_text=True)
html = res.get_data(as_text=True)
assert (
"Check you’ve entered the correct web address"
" or start again on the Digital Marketplace homepage." in html
)
assert (
"If you can’t find what you’re looking for, contact us at "
'<a class="govuk-link" href="mailto:cloud_digital@crowncommercial.gov.uk?'
'subject=Digital%20Marketplace%20feedback" title="Please '
'send feedback to cloud_digital@crowncommercial.gov.uk">'
"cloud_digital@crowncommercial.gov.uk</a>" in html
)

def test_503(self):
self.data_api_client.get_brief.side_effect = HTTPError('API is down')
Expand Down

0 comments on commit a481aef

Please sign in to comment.