Sha256: 5b4442380980c29af523f4406b9372885a98631e59118663640eb847cf6a7ae5

Contents?: true

Size: 1.64 KB

Versions: 10

Compression:

Stored size: 1.64 KB

Contents

<%
  add_gem_component_stylesheet("govspeak")

  inverse ||= false
  direction_class = "direction-#{direction}" if local_assigns.include?(:direction)
  disable_youtube_expansions = local_assigns.fetch(:disable_youtube_expansions) if local_assigns.include?(:disable_youtube_expansions)

  classes = []
  classes << direction_class if direction_class
  classes << "disable-youtube" if disable_youtube_expansions
  classes << "gem-c-govspeak--inverse" if inverse

  disable_ga4 ||= false

  data_modules = "govspeak"
  data_modules << " ga4-link-tracker" unless disable_ga4
  data_attributes = { module: data_modules }

  unless disable_ga4
    data_attributes.merge!({
      ga4_track_links_only: "",
      ga4_limit_to_element_class: "call-to-action, info-notice, help-notice, advisory",
      ga4_link: { "event_name": "navigation", "type": "callout" }.to_json,
    })
  end

%>

<%= tag.div(class: "gem-c-govspeak govuk-govspeak " + classes.join(" "), data: data_attributes) do %>
  <% if local_assigns.include?(:content) %>
    <% if content.html_safe? %>
      <%= content %>
    <% else %>
      <% raise "
        You've passed in unsanitised HTML into the Govspeak component as the
        `content` parameter.

        To fix this use a `do` block with the sanitize method - see
        https://components.publishing.service.gov.uk/component-guide/govspeak/
        for the updated documentation and
        https://github.com/alphagov/govuk_publishing_components/pull/1632/
        for further examples.

        Called from #{caller_locations.find { |l| l.to_s.include?('.erb') }}
        " %>
    <% end %>
  <% elsif block_given? %>
    <%= yield %>
  <% end %>
<% end %>

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
govuk_publishing_components-37.9.1 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-37.9.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-37.8.1 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-37.8.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-37.7.1 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-37.7.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-37.5.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-37.4.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-37.3.1 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-37.3.0 app/views/govuk_publishing_components/components/_govspeak.html.erb