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

No slimmer #1890

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ gem "gds-api-adapters"
gem "govuk_app_config"
gem "govuk_personalisation"
gem "govuk_publishing_components"
gem "govuk_web_banners", git: "https://github.com/alphagov/govuk_web_banners", branch: "emergency-banner"
gem "jwt"
gem "plek"
gem "ratelimit"
gem "slimmer"
gem "sprockets-rails"
gem "terser"

Expand Down
20 changes: 12 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
GIT
remote: https://github.com/alphagov/govuk_web_banners
revision: fa4bbf8cde0a639565b2c4e6f8c719f94edb22ec
branch: emergency-banner
specs:
govuk_web_banners (0.1.0)
govuk_app_config
govuk_publishing_components
rails (>= 7)
redis

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -594,13 +605,6 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
slimmer (18.6.2)
json
nokogiri (~> 1.7)
null_logger
plek (>= 1.1.0)
rack (>= 3.0)
rest-client
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
Expand Down Expand Up @@ -652,6 +656,7 @@ DEPENDENCIES
govuk_publishing_components
govuk_schemas
govuk_test
govuk_web_banners!
jwt
plek
pry-byebug
Expand All @@ -660,7 +665,6 @@ DEPENDENCIES
rspec-rails
rubocop-govuk
simplecov
slimmer
sprockets-rails
terser
timecop
Expand Down
3 changes: 3 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//= require govuk_publishing_components/dependencies
//= require govuk_publishing_components/lib
//= require govuk_publishing_components/components/error-summary
//= require govuk_publishing_components/components/radio
//= require govuk_publishing_components/components/feedback
//= require govuk_publishing_components/components/layout-super-navigation-header
2 changes: 2 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
// for components and views on pages where they are needed.

// https://github.com/alphagov/govuk_publishing_components/blob/main/docs/set-up-individual-component-css-loading.md

@import "govuk_publishing_components/all_components";
4 changes: 0 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
class ApplicationController < ActionController::Base
include GovukPersonalisation::ControllerConcern

include Slimmer::Template

before_action :set_cache_control_header

# Prevent CSRF attacks by raising an exception.
Expand Down Expand Up @@ -48,8 +46,6 @@ def use_govuk_account_layout?
false
end

slimmer_template :gem_layout

private

def set_cache_control_header
Expand Down
15 changes: 7 additions & 8 deletions app/controllers/subscriptions_management_controller.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
class SubscriptionsManagementController < ApplicationController
include Slimmer::Headers
include Slimmer::Template
before_action :handle_one_login_hint, only: [:index]
before_action :require_authentication
before_action :get_subscription_details
before_action :set_back_url
before_action :use_govuk_account_layout?

layout :choose_layout

def index; end

Expand Down Expand Up @@ -96,15 +95,15 @@ def confirmed_unsubscribe_all
end

def use_govuk_account_layout?
@use_govuk_account_layout ||=
if authenticated_via_account?
set_slimmer_headers(template: "gem_layout_account_manager")
true
end
@use_govuk_account_layout ||= authenticated_via_account?
end

private

def choose_layout
use_govuk_account_layout? ? "account" : "application"
end

def handle_one_login_hint
return unless params[:from] == "your-services" && !authenticated?

Expand Down
68 changes: 68 additions & 0 deletions app/views/layouts/account.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<% content_for :body do %>
<div id="wrapper">
<% content_for :before_content do %>
<%= yield :back_link %>
<% end %>
<%= yield :before_content %>
<main role="main" id="content">
<%= yield %>
</main>
</div>
<% end %>

<%= render "govuk_publishing_components/components/layout_for_public", {
title: yield(:title),
blue_bar: false,
emergency_banner: render("govuk_web_banners/emergency_banner"),
omit_feedback_form: true,
omit_footer_border: true,
omit_global_banner: true,
omit_footer_navigation: true,
product_name: "GOV.UK email subscriptions",
show_account_layout: true,
show_cross_service_header: true,
show_explore_header: false,
omit_account_navigation: true,
one_login_navigation_items: {
one_login_home: {
href: GovukPersonalisation::Urls.one_login_your_services,
data: {
module: "explicit-cross-domain-links",
link_for: "accounts-signed-in",
},
},
one_login_sign_out: {
text: "Sign out",
href: GovukPersonalisation::Urls.sign_out,
data: {
module: "explicit-cross-domain-links",
link_for: "accounts-signed-in",
},
},
},
footer_meta: { items: [
{
href: "https://signin.account.gov.uk/accessibility-statement",
text: "Accessibility statement"
},
{
href: "/help/cookies",
text: "Cookies"
},
{
href: "https://signin.account.gov.uk/terms-and-conditions",
text: "Terms and conditions"
},
{
href: "https://signin.account.gov.uk/privacy-statement",
text: "Privacy notice"
},
{
href: "https://signin.account.gov.uk/support",
text: "Support"
},
]},
} do %>
<%= yield :body %>
<%= javascript_include_tag 'application', type: "module" %>
<% end %>
60 changes: 18 additions & 42 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,47 +1,23 @@
<% content_for :body do %>
<% if use_govuk_account_layout? %>
<div id="wrapper">
<% content_for :before_content do %>
<%= yield :back_link %>
<% end %>
<%= yield :before_content %>
<main role="main" id="content">
<%= yield %>
</main>
</div>
<% else %>
<div class="govuk-width-container" id="wrapper">
<%= yield :back_link %>
<main class="govuk-main-wrapper<%= " govuk-main-wrapper--l" if yield(:back_link).blank?%>" role="main" id="content">
<div id="email-alert-frontend">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= yield %>
</div>
<div class="govuk-width-container" id="wrapper">
<%= yield :back_link %>
<main class="govuk-main-wrapper<%= " govuk-main-wrapper--l" if yield(:back_link).blank?%>" role="main" id="content">
<div id="email-alert-frontend">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= yield %>
</div>
</div>
</main>
</div>
<% end %>
</div>
</main>
</div>
<% end %>

<!DOCTYPE html>
<html>
<head>
<title><%= yield :title %> - GOV.UK</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<% if content_for(:meta_description).present? %>
<meta name="description" content="<%= content_for(:meta_description) %>" />
<% end %>
<%= yield :head %>
<meta name="robots" content="noindex, nofollow">
<%=
render_component_stylesheets
%>
</head>
<body class="govuk-template__body">
<%= yield :body %>
<%= javascript_include_tag 'application', type: "module" %>
</body>
</html>
<%= render "govuk_publishing_components/components/layout_for_public", {
title: yield(:title),
show_explore_header: true,
emergency_banner: render("govuk_web_banners/emergency_banner"),
} do %>
<%= yield :body %>
<%= javascript_include_tag 'application', type: "module" %>
<% end %>
1 change: 1 addition & 0 deletions config/initializers/govuk_publishing_components.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
GovukPublishingComponents.configure do |c|
c.component_guide_title = "Email Alert Frontend Component Guide"
c.application_stylesheet = "application"
c.exclude_css_from_static = false
end
4 changes: 4 additions & 0 deletions config/initializers/govuk_web_banners.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Rails.application.config.emergency_banner_redis_client = Redis.new(
url: ENV["EMERGENCY_BANNER_REDIS_URL"],
reconnect_attempts: [15, 30, 45, 60],
)
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
require File.expand_path("../config/environment", __dir__)
require "rspec/rails"
require "webmock/rspec"
require "slimmer/rspec"
require "gds_api/test_helpers/account_api"
require "gds_api/test_helpers/email_alert_api"

Expand Down
Loading