Skip to content

Commit

Permalink
Merge pull request #533 from alphagov/merge-errors
Browse files Browse the repository at this point in the history
Use one base template for all HTTP response pages
  • Loading branch information
bradwright committed Jan 22, 2015
2 parents ebdc5a2 + 2913857 commit e6d49e1
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 55 deletions.
2 changes: 1 addition & 1 deletion app/views/root/400.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render partial: "four_hundred_error", locals: {
<%= render partial: "error_page", locals: {
title: "Bad request - 400",
heading: "Bad request",
intro: ''
Expand Down
2 changes: 1 addition & 1 deletion app/views/root/404.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render partial: "four_hundred_error", locals: {
<%= render partial: "error_page", locals: {
title: "Page not found - 404",
heading: "Page not found",
intro: '<p>If you entered a web address please check it was correct.</p>
Expand Down
2 changes: 1 addition & 1 deletion app/views/root/406.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render partial: "four_hundred_error", locals: {
<%= render partial: "error_page", locals: {
title: "Page not found - 406",
heading: "The page you are looking for can't be found",
intro: '<p>Please check that you have entered the correct web address, or try using the search box above or explore <a href="/">GOV.UK</a> to find the information you need.</p>'
Expand Down
2 changes: 1 addition & 1 deletion app/views/root/410.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render partial: "four_hundred_error", locals: {
<%= render partial: "error_page", locals: {
title: "Page no longer here - 410",
heading: "The page you are looking for is no longer here",
intro: '<p>It may have been moved or replaced.</p>
Expand Down
2 changes: 1 addition & 1 deletion app/views/root/418.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render partial: "four_hundred_error", locals: {
<%= render partial: "error_page", locals: {
title: "This is a government website - 418",
heading: "I am not a coffee pot",
intro: "<p>I am a government website.</p>"
Expand Down
2 changes: 1 addition & 1 deletion app/views/root/500.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= render partial: "five_hundred_error", locals: {status_code: 500} %>
<%= render partial: "error_page", locals: {status_code: 500} %>
2 changes: 1 addition & 1 deletion app/views/root/501.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= render partial: "five_hundred_error", locals: {status_code: 501} %>
<%= render partial: "error_page", locals: {status_code: 501} %>
2 changes: 1 addition & 1 deletion app/views/root/503.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= render partial: "five_hundred_error", locals: {status_code: 503} %>
<%= render partial: "error_page", locals: {status_code: 503} %>
2 changes: 1 addition & 1 deletion app/views/root/504.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= render partial: "five_hundred_error", locals: {status_code: 504} %>
<%= render partial: "error_page", locals: {status_code: 504} %>
32 changes: 32 additions & 0 deletions app/views/root/_error_page.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<% title = "Sorry, we are experiencing technical difficulties (#{status_code} error)" unless local_assigns.include?(:title) %>
<% content_for :title, "#{title} - GOV.UK" %>

<% content_for :body_classes, "mainstream error" %>

<% content_for :wrapper_content do %>
<main id="content" role="main" class="group">

<header class="page-header group">
<div>
<% if local_assigns.include?(:heading) %>
<h1><%= heading %></h1>
<% else %>
<h1>Sorry, we are experiencing technical difficulties</h1>
<% end %>
</div>
</header>
<div class="article-container">
<article role="article" class="group">
<div class="inner">
<% if local_assigns.include?(:intro) %>
<%= raw intro %>
<% else %>
<p>Please try again in a few moments.</p>
<% end %>
</div>
</article>
</div>
</main>
<% end %>

<%= render partial: 'base' %>
23 changes: 0 additions & 23 deletions app/views/root/_five_hundred_error.html.erb

This file was deleted.

23 changes: 0 additions & 23 deletions app/views/root/_four_hundred_error.html.erb

This file was deleted.

0 comments on commit e6d49e1

Please sign in to comment.