Sha256: e08569781ece32364540f062afb7b5b0b529bf970b21c04d2426bb6a7a8ce3d6

Contents?: true

Size: 1.46 KB

Versions: 13

Compression:

Stored size: 1.46 KB

Contents

<%
add_gem_component_stylesheet("phase-banner")

app_name ||= nil
phase ||= nil
message ||= nil
inverse ||= false
disable_ga4 ||= false

unless message.present?
  if phase == "beta"
    message = raw("This part of GOV.UK is being rebuilt &ndash; <a class=\"govuk-link\" href=\"/help/beta\">find out what beta means</a>")
  elsif phase == "alpha"
    message = raw("This part of GOV.UK is being built &ndash; <a class=\"govuk-link\" href=\"/service-manual/agile-delivery/how-the-alpha-phase-works\">find out what alpha means</a>")
  end
end

component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
component_helper.add_class("gem-c-phase-banner govuk-phase-banner")
component_helper.add_class("gem-c-phase-banner--inverse") if inverse

unless disable_ga4
  component_helper.add_data_attribute({
    ga4_phase_banner: phase,
    module: "ga4-link-tracker",
    ga4_track_links_only: "",
    ga4_set_indexes: "",
    ga4_link: {
      event_name: "navigation",
      type: "phase banner",
      section: Nokogiri::HTML(message).text,
    }.to_json
  })
end

%>

<%= tag.div(**component_helper.all_attributes) do %>
  <%= tag.p class: "govuk-phase-banner__content" do %>
    <%= tag.strong app_name, class: "govuk-phase-banner__content__app-name" if app_name %>
    <%= tag.strong phase.titleize, class: "govuk-tag govuk-phase-banner__content__tag" if phase %>
    <%= tag.span message, class: "govuk-phase-banner__text" if message %>
  <% end %>
<% end %>

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
govuk_publishing_components-51.1.0 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-51.0.0 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-50.0.1 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-50.0.0 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-49.1.0 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-49.0.0 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-48.0.0 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-47.0.0 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-46.4.0 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-46.3.1 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-46.3.0 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-46.2.0 app/views/govuk_publishing_components/components/_phase_banner.html.erb
govuk_publishing_components-46.1.0 app/views/govuk_publishing_components/components/_phase_banner.html.erb