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

[155] Add govuk markdown and cookies page #103

Merged
merged 4 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ gem "bootsnap", require: false
gem "govuk-components"
gem "govuk_design_system_formbuilder"

# Convert Markdown into HTML
gem "govuk_markdown"

# Provide endpoint for server healthchecks
gem "okcomputer"

Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ GEM
activemodel (>= 6.1)
activesupport (>= 6.1)
html-attributes-utils (~> 1)
govuk_markdown (2.0.1)
activesupport
redcarpet
haml (6.1.1)
temple (>= 0.8.2)
thor
Expand Down Expand Up @@ -345,6 +348,7 @@ GEM
rainbow (3.1.1)
rake (13.0.6)
rbs (2.8.4)
redcarpet (3.6.0)
redis (4.8.1)
regexp_parser (2.8.1)
reline (0.3.5)
Expand Down Expand Up @@ -522,6 +526,7 @@ DEPENDENCIES
govuk-components
govuk_design_system_formbuilder
govuk_feature_flags!
govuk_markdown
jsbundling-rails
launchy
okcomputer
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/static_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

class StaticController < ApplicationController
layout "two_thirds"
end
99 changes: 4 additions & 95 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,96 +1,5 @@
<!DOCTYPE html>
<html lang="en" class="govuk-template">
<head>
<title><%= [yield(:page_title).presence, t('service.name')].compact.join(' - ') %></title>
<% content_for :content do %>
<%= yield %>
<% end %>

<%= csrf_meta_tags %>
<%= csp_meta_tag %>

<%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %>
<%= tag :meta, property: 'og:image', content: asset_path('images/govuk-opengraph-image.png') %>
<%= tag :meta, name: 'theme-color', content: '#0b0c0c' %>
<%= favicon_link_tag asset_path('images/favicon.ico') %>
<%= favicon_link_tag asset_path('images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %>

<%= stylesheet_link_tag :main %>
<%= javascript_include_tag :application, defer: true %>
</head>

<body class="govuk-template__body">
<%= javascript_tag nonce: true do %>
document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');
<% end %>

<%= govuk_skip_link %>

<%= govuk_header(service_name: t("service.name")) do |header|
if current_dsi_user
header.with_navigation_item(href: "/sign-out", text: "Sign out")
else
header.with_navigation_item(href: "/sign-in", text: "Sign in")
end

if support_interface?
header.with_navigation_item(href: "/support/features", text: "Features")
header.with_navigation_item(href: "/support/uploads/new", text: "File upload")
end
end %>

<div class="govuk-width-container">
<%= govuk_phase_banner(tag: { text: "Beta" }) do %>
This is a new service – your
<%= govuk_link_to("feedback", main_app.feedbacks_path) %>
will help us to improve it.
<% end %>
<%= govuk_back_link(href: yield(:back_link_url)) if content_for?(:back_link_url) %>
<%= yield(:breadcrumbs) if content_for?(:breadcrumbs) %>
<main class="govuk-main-wrapper" id="main-content" role="main">
<%= yield %>
</main>
</div>

<%= render GovukComponent::FooterComponent.new do |footer| %>
<% footer.with_meta do %>
<div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
<h2 class="govuk-heading-m">Get help</h2>
<p class="govuk-!-font-size-16">
Email: <%= govuk_mail_to t('service.email'), t('service.email'), class: "govuk-footer__link" %>
<br>
You’ll get a response within 3 working days.
</p>

<p class="govuk-!-font-size-16">Phone: 020 7593 5393<br>Monday to Friday, 9am to 5pm (except public holidays)</p>
<hr class="govuk-section-break govuk-section-break--l">

<h2 class="govuk-visually-hidden">Footer links</h2>

<ul class="govuk-footer__inline-list">
<li class="govuk-footer__inline-list-item">
<%= govuk_link_to("Accessibility", "/qualifications/accessibility", class: "govuk-footer__link") %>
</li>
<li class="govuk-footer__inline-list-item">
<%= govuk_link_to("Cookies", "/qualifications/cookies", class: "govuk-footer__link") %>
</li>
<li class="govuk-footer__inline-list-item">
<%= govuk_link_to("Privacy notice", "/qualifications/privacy", class: "govuk-footer__link") %>
</li>
</ul>

<svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 483.2 195.7" height="17" width="41">
<path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"></path>
</svg>

<span class="govuk-footer__licence-description">All content is available under the <%= govuk_link_to("Open Government Licence v3.0", "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/", class: "govuk-footer__link") %>, except where otherwise stated</span>
</div>

<div class="govuk-footer__meta-item">
<%= footer.copyright %>
</div>
<% end %>
<% end %>
</body>
</html>
<%= render template: 'layouts/base' %>
96 changes: 96 additions & 0 deletions app/views/layouts/base.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<!DOCTYPE html>
<html lang="en" class="govuk-template">
<head>
<title><%= [yield(:page_title).presence, t('service.name')].compact.join(' - ') %></title>

<%= csrf_meta_tags %>
<%= csp_meta_tag %>

<%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %>
<%= tag :meta, property: 'og:image', content: asset_path('images/govuk-opengraph-image.png') %>
<%= tag :meta, name: 'theme-color', content: '#0b0c0c' %>
<%= favicon_link_tag asset_path('images/favicon.ico') %>
<%= favicon_link_tag asset_path('images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %>

<%= stylesheet_link_tag :main %>
<%= javascript_include_tag :application, defer: true %>
</head>

<body class="govuk-template__body">
<%= javascript_tag nonce: true do %>
document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');
<% end %>

<%= govuk_skip_link %>

<%= govuk_header(service_name: t("service.name")) do |header|
if current_dsi_user
header.with_navigation_item(href: "/sign-out", text: "Sign out")
else
header.with_navigation_item(href: "/sign-in", text: "Sign in")
end

if support_interface?
header.with_navigation_item(href: "/support/features", text: "Features")
header.with_navigation_item(href: "/support/uploads/new", text: "File upload")
end
end %>

<div class="govuk-width-container">
<%= govuk_phase_banner(tag: { text: "Beta" }) do %>
This is a new service – your
<%= govuk_link_to("feedback", main_app.feedbacks_path) %>
will help us to improve it.
<% end %>
<%= govuk_back_link(href: yield(:back_link_url)) if content_for?(:back_link_url) %>
<%= yield(:breadcrumbs) if content_for?(:breadcrumbs) %>
<main class="govuk-main-wrapper" id="main-content" role="main">
<%= yield :content %>
</main>
</div>

<%= render GovukComponent::FooterComponent.new do |footer| %>
<% footer.with_meta do %>
<div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
<h2 class="govuk-heading-m">Get help</h2>
<p class="govuk-!-font-size-16">
Email: <%= govuk_mail_to t('service.email'), t('service.email'), class: "govuk-footer__link" %>
<br>
You’ll get a response within 3 working days.
</p>

<p class="govuk-!-font-size-16">Phone: 020 7593 5393<br>Monday to Friday, 9am to 5pm (except public holidays)</p>
<hr class="govuk-section-break govuk-section-break--l">

<h2 class="govuk-visually-hidden">Footer links</h2>

<ul class="govuk-footer__inline-list">
<li class="govuk-footer__inline-list-item">
<%= govuk_link_to("Accessibility", "/accessibility", class: "govuk-footer__link") %>
</li>
<li class="govuk-footer__inline-list-item">
<%= govuk_link_to("Cookies", "/cookies", class: "govuk-footer__link") %>
</li>
<li class="govuk-footer__inline-list-item">
<%= govuk_link_to("Privacy notice", "/privacy", class: "govuk-footer__link") %>
</li>
</ul>

<svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 483.2 195.7" height="17" width="41">
<path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"></path>
</svg>

<span class="govuk-footer__licence-description">All content is available under the <%= govuk_link_to("Open Government Licence v3.0", "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/", class: "govuk-footer__link") %>, except where otherwise stated</span>
</div>

<div class="govuk-footer__meta-item">
<%= footer.copyright %>
</div>
<% end %>
<% end %>
</body>
</html>
9 changes: 9 additions & 0 deletions app/views/layouts/two_thirds.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<% content_for :content do %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= yield %>
</div>
</div>
<% end %>

<%= render template: 'layouts/base' %>
38 changes: 38 additions & 0 deletions app/views/static/cookies.html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<% content_for :page_title, 'Cookies' %>

# Cookies

Cookies are small files saved on your phone, tablet or computer when you visit
a website.

We use cookies to make the <%= t('service.name') %> service work and
collect information about how you use our service.

## Essential cookies

Essential cookies keep your information secure while you use the <%=
t('service.name') %> service. We do not need to ask permission to use them.

<table class="govuk-table">
<caption class="govuk-visually-hidden">Essential cookies</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header">Name</th>
<th class="govuk-table__header">Purpose</th>
<th class="govuk-table__header">Expires</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<td class="govuk-table__cell">
_check_the_childrens_barred_list_session
</td>
<td class="govuk-table__cell" width="50%">
Used to keep you signed in
</td>
<td class="govuk-table__cell">
When the session ends
</td>
</tr>
</tbody>
</table>
1 change: 0 additions & 1 deletion config/credentials.yml.enc

This file was deleted.

11 changes: 11 additions & 0 deletions config/initializers/govuk_markdown.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

class MarkdownTemplate
def self.call(template, source)
erb_handler = ActionView::Template.registered_template_handler(:erb)
compiled_source = erb_handler.call(template, source)
"GovukMarkdown.render(begin;#{compiled_source};end).html_safe"
end
end

ActionView::Template.register_template_handler :md, MarkdownTemplate
11 changes: 7 additions & 4 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
get "/sign-out", to: "sign_out#new"

get "/auth/dfe/callback", to: "omniauth_callbacks#dfe"
post "/auth/developer/callback" => "omniauth_callbacks#dfe_bypass"
post "/auth/developer/callback", to: "omniauth_callbacks#dfe_bypass"

scope "/feedback" do
get "/" => "feedbacks#new", :as => :feedbacks
post "/" => "feedbacks#create"
get "/success" => "feedbacks#success"
get "/", to: "feedbacks#new", as: :feedbacks
post "/", to: "feedbacks#create"
get "/success", to: "feedbacks#success"
end

get "/accessibility", to: "static#accessibility"
get "/cookies", to: "static#cookies"

namespace :support_interface, path: "/support" do
root to: redirect("/support/features")

Expand Down