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 #4621

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
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ gem "plek"
gem "rack-utf8_sanitizer"
gem "rails-i18n"
gem "rails_translation_manager"
gem "slimmer"
gem "sprockets-rails"
gem "terser"
gem "uk_postcode"
Expand Down
8 changes: 0 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -697,13 +697,6 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
slimmer (18.7.0)
json
nokogiri (~> 1.7)
null_logger
plek (>= 1.1.0)
rack (>= 3.0)
rest-client
smart_properties (1.17.0)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -789,7 +782,6 @@ DEPENDENCIES
rspec-rails
rubocop-govuk
simplecov
slimmer
sprockets-rails
terser
timecop
Expand Down
3 changes: 3 additions & 0 deletions app/assets/javascripts/dependencies.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// This file contains the dependencies required by the application.
//= require govuk_publishing_components/dependencies
//= require govuk_publishing_components/lib
//= require govuk_publishing_components/components/error-summary
//= require govuk_publishing_components/components/feedback
//= require govuk_publishing_components/components/govspeak
//= require govuk_publishing_components/components/image-card
//= require govuk_publishing_components/components/intervention
//= require govuk_publishing_components/components/layout-super-navigation-header
//= require govuk_publishing_components/components/metadata
//= require govuk_publishing_components/components/print-link
//= require govuk_publishing_components/components/radio
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
$govuk-include-default-font-face: false;

@import "govuk_publishing_components/govuk_frontend_support";
@import "govuk_publishing_components/component_support";

// Helper stylesheets (things on more than one page layout)
@import "helpers/truncated-url";
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
class ApplicationController < ActionController::Base
include Slimmer::Headers
include Slimmer::Template
slimmer_template "gem_layout"

before_action do
I18n.locale = I18n.default_locale
end
Expand Down
6 changes: 2 additions & 4 deletions app/controllers/homepage_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
class HomepageController < ContentItemsController
include Cacheable

slimmer_template "gem_layout_homepage"
layout "homepage"

def index
set_slimmer_headers(template: "gem_layout_homepage_new")
end
def index; end

Check failure on line 6 in app/controllers/homepage_controller.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Layout/ExtraSpacing: Unnecessary spacing detected.
end
3 changes: 1 addition & 2 deletions app/controllers/landing_page_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class LandingPageController < ContentItemsController
slimmer_template "gem_layout_full_width"

Check failure on line 2 in app/controllers/landing_page_controller.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body beginning. (https://rubystyle.guide#empty-lines-around-bodies)
private
private

Check failure on line 3 in app/controllers/landing_page_controller.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Layout/AccessModifierIndentation: Outdent access modifiers like `private`. (https://rubystyle.guide#indent-public-private-protected)

# SCAFFOLDING: can be removed when basic content items are available
# from content-store
Expand Down
1 change: 0 additions & 1 deletion app/controllers/travel_advice_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ def index

respond_to do |format|
format.html do
slimmer_template "gem_layout"
end
format.atom do
set_expiry(5.minutes)
Expand Down
93 changes: 36 additions & 57 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,66 +1,45 @@
<% content_for :body do %>
<% if @is_account && local_assigns %>
<main id="content">
<% if content_item&.phase == "beta" %>
<%= render "govuk_publishing_components/components/phase_banner", phase: "beta" %>
<% end %>
<% unless !(content_item || @calendar) || remove_breadcrumbs(content_item) %>
<%= render "govuk_publishing_components/components/contextual_breadcrumbs", content_item: content_item.to_h %>
<% end %>
<%= render "govuk_web_banners/recruitment_banner" %>
<% if local_assigns %>
<%= yield :before_content %>
<main role="main" id="content" class="govuk-main-wrapper <%= yield :main_classes %>" <%= lang_attribute %>>
<%= yield %>
</main>
<% else %>
<% if content_item&.phase == "beta" %>
<%= render "govuk_publishing_components/components/phase_banner", phase: "beta" %>
<% end %>
<% unless current_page?(root_path) || !(content_item || @calendar) || remove_breadcrumbs(content_item) %>
<%= render "govuk_publishing_components/components/contextual_breadcrumbs", content_item: content_item.to_h %>
<% end %>
<%= render "govuk_web_banners/recruitment_banner" %>
<% if local_assigns %>
<%= yield :before_content %>
<main role="main" id="content" class="govuk-main-wrapper <%= yield :main_classes %>" <%= lang_attribute %>>
<%= yield %>
</main>
<%= yield :after_content %>
<% end %>
<%= yield :after_content %>
<% end %>
<% end %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><%=
page_title = yield :title
if page_title.present?
page_title
elsif content_item
page_title(content_item)
else
"GOV.UK"
end
%></title>
<%= yield :extra_stylesheets %>

<link title="Search" rel="search" type="application/opensearchdescription+xml" href="/search/opensearch.xml">

<%= stylesheet_link_tag "application.css", :media => "all", integrity: false %>
<%
title = yield(:title)
title = if title.present?
title
elsif content_item
page_title(content_item)
else
"GOV.UK"
end
%>

<%=
render_component_stylesheets
%>

<%= javascript_include_tag "test-dependencies.js", type: "module" if Rails.env.test? %>
<%= javascript_include_tag "application.js", integrity: false, type: "module" %>
<%= content_for :head do %>
<link title="Search" rel="search" type="application/opensearchdescription+xml" href="/search/opensearch.xml">
<%= render_component_stylesheets %>
<% end %>

<%= yield :extra_javascript %>
<%= yield :extra_headers %>
<% if content_item.to_h %>
<%= render "govuk_publishing_components/components/meta_tags", content_item: content_item.to_h %>
<%# TODO: use content_item.meta_content %>
<% if content_item&.meta_section.present? %>
<meta name="govuk:section" content="<%= content_item.meta_section %>">
<% end %>
<% end %>
</head>
<%= render "govuk_publishing_components/components/layout_for_public", {
title:,
show_explore_header: true,
# emergency_banner: render("govuk_web_banners/emergency_banner"),
global_banner: render("govuk_web_banners/global_banner"),
} do %>
<div class="govuk-width-container">
<%= yield :body %>
</div>
<%= javascript_include_tag 'application', type: "module" %>
<% end %>

<body class="mainstream <%= yield :body_classes %>">
<div id="wrapper" class="<%= wrapper_class(content_item) %> direction-<%= page_text_direction %>">
<%= yield :body %>
</div>
</body>
</html>
41 changes: 41 additions & 0 deletions app/views/layouts/homepage.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<% content_for :body do %>
<%= yield :before_content %>
<main role="main" id="content" class="govuk-main-wrapper <%= yield :main_classes %>" <%= lang_attribute %>>
<%= yield %>
</main>
<%= yield :after_content %>
<% end %>

<%
title = yield(:title)
title = if title.present?
title
elsif content_item
page_title(content_item)
else
"GOV.UK"
end
%>

<%= content_for :head do %>
<link title="Search" rel="search" type="application/opensearchdescription+xml" href="/search/opensearch.xml">
<% add_gem_component_stylesheet("layout-for-public") %>
<% add_gem_component_stylesheet("layout-super-navigation-header") %>
<% add_gem_component_stylesheet("layout-header") %>
<% add_gem_component_stylesheet("layout-footer") %>
<%= render_component_stylesheets %>
<% end %>

<%= render "govuk_publishing_components/components/layout_for_public", {
title:,
full_width: true,
homepage: true,
show_explore_header: true,
# emergency_banner: render("govuk_web_banners/emergency_banner"),
global_banner: render("govuk_web_banners/global_banner"),
logo_link: Plek.new.website_root.present? ? Plek.new.website_root : "https://www.gov.uk/",
} 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,5 +1,6 @@
if defined?(GovukPublishingComponents)
GovukPublishingComponents.configure do |c|
c.component_guide_title = "Frontend Component Guide"
c.exclude_css_from_static = false
end
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],
)
3 changes: 0 additions & 3 deletions config/initializers/slimmer.rb

This file was deleted.

1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
require File.expand_path("../config/environment", __dir__)
require "rspec/rails"
require "capybara/rails"
require "slimmer/rspec"
require "timecop"
require "webmock/rspec"
WebMock.disable_net_connect!(allow_localhost: true)
Expand Down
6 changes: 0 additions & 6 deletions spec/system/travel_advice_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@
expect(page.title).to eq("Foreign travel advice - GOV.UK")
end

it "sets the slimmer #wrapper classes" do
visit "/foreign-travel-advice"

expect(page.find("#wrapper")["class"]).to include("travel-advice")
end

it "displays breadcrumbs" do
visit "/foreign-travel-advice"

Expand Down
Loading