Skip to content

Commit

Permalink
Support account layout
Browse files Browse the repository at this point in the history
  • Loading branch information
KludgeKML committed Nov 14, 2024
1 parent 397188d commit 5a0885d
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 29 deletions.
14 changes: 7 additions & 7 deletions app/controllers/subscriptions_management_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ class SubscriptionsManagementController < ApplicationController
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 @@ -94,16 +95,15 @@ def confirmed_unsubscribe_all
end

def use_govuk_account_layout?
@use_govuk_account_layout ||=
if authenticated_via_account?
# TODO: HERE WE NEED THE ACCOUNT MANAGER LAYOUT
# 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
67 changes: 67 additions & 0 deletions app/views/layouts/account.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<% 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,
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 %>
32 changes: 10 additions & 22 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
<% 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 %>
<%= render "govuk_publishing_components/components/layout_for_public", {
Expand Down

0 comments on commit 5a0885d

Please sign in to comment.