Skip to content

Commit

Permalink
Refactor layout_for_public template
Browse files Browse the repository at this point in the history
Simplify the main layout_for_public component code by breaking parts of
the component out into separate partials
  • Loading branch information
danacotoran committed Aug 11, 2021
1 parent b081ead commit 364a7bb
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,60 +114,25 @@
<% end %>

<% if show_account_layout %>
<div class="<%= "govuk-width-container" unless full_width %>">
<% message = capture do %>
<%= t("components.layout_for_public.account_layout.feedback.banners.phase_intro") %>
<a class="govuk-link" href=<%= "#{Plek.find('account-manager')}/feedback" %>><%= t("components.layout_for_public.account_layout.feedback.banners.phase_link") %></a>
<%= t("components.layout_for_public.account_layout.feedback.banners.phase_outro") %>
<% end %>

<%= render "govuk_publishing_components/components/phase_banner", {
phase: "alpha",
message: message
} unless omit_account_phase_banner %>


<div class="govuk-grid-row govuk-main-wrapper">
<%= tag.div(class: 'govuk-grid-column-one-third') do %>
<%= render "govuk_publishing_components/components/layout_for_public/account-navigation", { page_is: account_nav_location} %>
<% end unless omit_account_navigation %>

<div class="govuk-grid-column-two-thirds">
<div id="wrapper">
<%= yield :before_content %>
<main role="main" id="content">
<%= yield %>
</main>
</div>
</div>
</div>
</div>
<% else %>
<div id="wrapper" class="<%= "govuk-width-container" unless full_width %>">
<%= yield :before_content %>
<main class="govuk-main-wrapper" id="content">
<%= yield %>
</main>
</div>
<%= render "govuk_publishing_components/components/layout_for_public/account-layout", {
omit_account_phase_banner: omit_account_phase_banner,
omit_account_navigation: omit_account_navigation,
account_nav_location: account_nav_location,
} do %>
<%= yield :before_content %>
<%= yield %>
<% end %>
<% else %>
<div id="wrapper" class="<%= "govuk-width-container" unless full_width %>">
<%= yield :before_content %>
<main class="govuk-main-wrapper" id="content">
<%= yield %>
</main>
</div>
<% end %>

<% if show_account_layout %>
<%= tag.div(class: "govuk-width-container") do %>
<%= tag.div(class: "gem-c-layout-for-public-account-feedback-footer") do %>
<%= render "govuk_publishing_components/components/heading", {
text: t("components.layout_for_public.account_layout.feedback.banners.title"),
heading_level: 2,
font_size: "m",
margin_bottom: 4,
} %>

<p class="govuk-body govuk-!-margin-bottom-0">
<%= t("components.layout_for_public.account_layout.feedback.banners.footer_intro") %>
<a href="<%= "#{Plek.find('account-manager')}/feedback" %>" class="govuk-link"><%= t("components.layout_for_public.account_layout.feedback.banners.footer_link") %></a>
<%= t("components.layout_for_public.account_layout.feedback.banners.footer_outro") %>
</p>
<% end %>
<% end unless omit_account_feedback_footer %>
<% if show_account_layout && !omit_account_feedback_footer %>
<%= render "govuk_publishing_components/components/layout_for_public/account-feedback-footer" %>
<% elsif !omit_feedback_form %>
<div class="govuk-width-container">
<%= render "govuk_publishing_components/components/feedback" %>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%= tag.div(class: "govuk-width-container") do %>
<%= tag.div(class: "gem-c-layout-for-public-account-feedback-footer") do %>
<%= render "govuk_publishing_components/components/heading", {
text: t("components.layout_for_public.account_layout.feedback.banners.title"),
heading_level: 2,
font_size: "m",
margin_bottom: 4,
} %>

<p class="govuk-body govuk-!-margin-bottom-0">
<%= t("components.layout_for_public.account_layout.feedback.banners.footer_intro") %>
<a href="<%= "#{Plek.find('account-manager')}/feedback" %>" class="govuk-link"><%= t("components.layout_for_public.account_layout.feedback.banners.footer_link") %></a>
<%= t("components.layout_for_public.account_layout.feedback.banners.footer_outro") %>
</p>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<div class="govuk-width-container">
<% message = capture do %>
<%= t("components.layout_for_public.account_layout.feedback.banners.phase_intro") %>
<a class="govuk-link" href=<%= "#{Plek.find('account-manager')}/feedback" %>><%= t("components.layout_for_public.account_layout.feedback.banners.phase_link") %></a>
<%= t("components.layout_for_public.account_layout.feedback.banners.phase_outro") %>
<% end %>

<%= render "govuk_publishing_components/components/phase_banner", {
phase: "alpha",
message: message
} unless omit_account_phase_banner %>


<div class="govuk-grid-row govuk-main-wrapper">
<%= tag.div(class: 'govuk-grid-column-one-third') do %>
<%= render "govuk_publishing_components/components/layout_for_public/account-navigation", { page_is: account_nav_location} %>
<% end unless omit_account_navigation %>

<div class="govuk-grid-column-two-thirds">
<div id="wrapper">
<%= yield :before_content %>
<main role="main" id="content">
<%= yield %>
</main>
</div>
</div>
</div>
</div>

0 comments on commit 364a7bb

Please sign in to comment.