From 88e6ed4dfd29d734ad43adb3a8bd24169aaf344e Mon Sep 17 00:00:00 2001 From: Simon Hughesdon Date: Mon, 8 Mar 2021 15:55:57 +0000 Subject: [PATCH] Allow showing individual global bar links It's possible that we might want to show only one of the Brexit/Covid links that are on the global bar. This PR allows this and makes the margin underneath the upper link dependent on whether there is anything below it. --- app/views/notifications/_global_bar.html.erb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/views/notifications/_global_bar.html.erb b/app/views/notifications/_global_bar.html.erb index a267569f2..c7d35753b 100644 --- a/app/views/notifications/_global_bar.html.erb +++ b/app/views/notifications/_global_bar.html.erb @@ -6,14 +6,18 @@ link_text = false link_href = false + show_coronavirus_link = true coronavirus_title = "Coronavirus (COVID-19)" coronavirus_href = "/coronavirus" coronavirus_subtext = "National lockdown: stay at home" + show_transition_link = true transition_title = "Brexit" transition_href = "/transition" transition_subtext = "Check what you need to do" + coronavirus_link_margin_bottom = show_transition_link ? { margin_bottom: 3 } : {} + # Toggles banner being permanently visible # If true, banner is always_visible & does not disappear automatically after 3 pageviews # Regardless of value, banner is always manually dismissable by users @@ -66,8 +70,11 @@

<% end %> - <% if coronavirus_title && coronavirus_href %> + <% if show_coronavirus_link || show_transition_link %>
+ <% end %> + + <% if show_coronavirus_link %> <%= render "govuk_publishing_components/components/action_link", { text: coronavirus_title, href: coronavirus_href, @@ -75,9 +82,11 @@ classes: "js-call-to-action", light_text: true, simple_light: true, - margin_bottom: 3 - } %> + }.merge(coronavirus_link_margin_bottom) + %> + <% end %> + <% if show_transition_link %> <%= render "govuk_publishing_components/components/action_link", { text: transition_title, href: transition_href, @@ -86,6 +95,9 @@ light_text: true, simple_light: true } %> + <% end %> + + <% if show_coronavirus_link || show_transition_link %>
<% end %>