diff --git a/Gemfile b/Gemfile index 57a6b90f..1a2e8082 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/Gemfile.lock b/Gemfile.lock index 7d287505..8ea110bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 @@ -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) @@ -522,6 +526,7 @@ DEPENDENCIES govuk-components govuk_design_system_formbuilder govuk_feature_flags! + govuk_markdown jsbundling-rails launchy okcomputer diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb new file mode 100644 index 00000000..c48687e6 --- /dev/null +++ b/app/controllers/static_controller.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class StaticController < ApplicationController + layout "two_thirds" +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 40e134ed..a5e665ad 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,96 +1,5 @@ - - - - <%= [yield(:page_title).presence, t('service.name')].compact.join(' - ') %> +<% 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 %> - - - - <%= 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 %> - -
- <%= 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) %> -
- <%= yield %> -
-
- - <%= render GovukComponent::FooterComponent.new do |footer| %> - <% footer.with_meta do %> - - - - <% end %> - <% end %> - - +<%= render template: 'layouts/base' %> diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb new file mode 100644 index 00000000..eb952b1c --- /dev/null +++ b/app/views/layouts/base.html.erb @@ -0,0 +1,96 @@ + + + + <%= [yield(:page_title).presence, t('service.name')].compact.join(' - ') %> + + <%= 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 %> + + + + <%= 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 %> + +
+ <%= 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) %> +
+ <%= yield :content %> +
+
+ + <%= render GovukComponent::FooterComponent.new do |footer| %> + <% footer.with_meta do %> + + + + <% end %> + <% end %> + + diff --git a/app/views/layouts/two_thirds.html.erb b/app/views/layouts/two_thirds.html.erb new file mode 100644 index 00000000..167aa779 --- /dev/null +++ b/app/views/layouts/two_thirds.html.erb @@ -0,0 +1,9 @@ +<% content_for :content do %> +
+
+ <%= yield %> +
+
+<% end %> + +<%= render template: 'layouts/base' %> diff --git a/app/views/static/cookies.html.md b/app/views/static/cookies.html.md new file mode 100644 index 00000000..e4aa485e --- /dev/null +++ b/app/views/static/cookies.html.md @@ -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. + + + + + + + + + + + + + + + + + +
Essential cookies
NamePurposeExpires
+ _check_the_childrens_barred_list_session + + Keeps you signed in + + When you close your browser +
diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc deleted file mode 100644 index afaffad3..00000000 --- a/config/credentials.yml.enc +++ /dev/null @@ -1 +0,0 @@ -PkFLAnOXpie3QUSaCQXK/cl7VSxSDwFvnN43CbEZGTE9xECy80bV+dm20RBhdg9Tj6YWeqadnAeretwkLhpgR0IZ7NxLNTiG/wn7Y0Hdskp7mMKQRBNFf3rpsh/R97j6FwGgNSZpc2wUF3+bnSJ2G/1nEv4x6fIoCsWEsuGreiqTazeAeMHdbzufZxT6NHmyaNtM9YFbXg9m7HykXhbVmw+I472B671TPRlCjpLBIGDdQJf2pL2JAC0Y2g/Et6r3aja4hDRpxvHvdZkYLSadUtfd99q5ySZCeLtVPqpIS8in1TTtVNlqtI2OVJHAxwUjQmU4XN2bVM3abJa/CrmIBEZqbbQp3IflszyzbRLUVu/0IXSMQJk1Dqlf0fR8VPMz2sLAyJFndcDaESReOkbcKm5sREFISGAaDphb--+oCHGY4QervSBcV7--Wkq+6lLzVDDnMzlN2+rShw== \ No newline at end of file diff --git a/config/initializers/govuk_markdown.rb b/config/initializers/govuk_markdown.rb new file mode 100644 index 00000000..1d017a3d --- /dev/null +++ b/config/initializers/govuk_markdown.rb @@ -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 diff --git a/config/routes.rb b/config/routes.rb index 6dd63b99..cb09e0bd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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")