Sha256: 5e06603e2596d65b605c67580cdfa895bf1992a7839bb3f6410d18cf176efb82

Contents?: true

Size: 1.5 KB

Versions: 9

Compression:

Stored size: 1.5 KB

Contents

<%
  add_gem_component_stylesheet("govspeak")

  inverse ||= false
  local_assigns[:margin_bottom] ||= 0
  direction_class = "gem-c-govspeak--direction-#{direction}" if local_assigns.include?(:direction)
  disable_youtube_expansions = local_assigns.fetch(:disable_youtube_expansions) if local_assigns.include?(:disable_youtube_expansions)

  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
  component_helper.add_class("gem-c-govspeak govuk-govspeak")
  component_helper.add_class(direction_class) if direction_class
  component_helper.add_class("js-disable-youtube") if disable_youtube_expansions
  component_helper.add_class("gem-c-govspeak--inverse") if inverse
  component_helper.add_data_attribute({ module: "govspeak" })
%>
<%= tag.div(**component_helper.all_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

9 entries across 9 versions & 1 rubygems

Version Path
govuk_publishing_components-51.1.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-51.0.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-50.0.1 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-50.0.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-49.1.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-49.0.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-48.0.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-47.0.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-46.4.0 app/views/govuk_publishing_components/components/_govspeak.html.erb