Sha256: fb114bdcc1dffc3441803a01e3fcb16709f5d100cb20e1c78542820cc7c183ff

Contents?: true

Size: 1.31 KB

Versions: 42

Compression:

Stored size: 1.31 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

  data_modules = "govspeak"
  data_attributes = { module: data_modules }

%>

<%= 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

42 entries across 42 versions & 1 rubygems

Version Path
govuk_publishing_components-44.4.2 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-44.4.1 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-44.4.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-44.3.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-44.2.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-44.1.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-44.0.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-43.5.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-43.4.1 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-43.4.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-43.3.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-43.2.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-43.1.1 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-43.1.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-43.0.2 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-43.0.1 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-43.0.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-42.1.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-42.0.0 app/views/govuk_publishing_components/components/_govspeak.html.erb
govuk_publishing_components-41.1.2 app/views/govuk_publishing_components/components/_govspeak.html.erb