Sha256: 0a89de36b66d26b3fc34ce17ae0344ab62cfaa2e2ace0e9b71fb84afc95d8728

Contents?: true

Size: 1.22 KB

Versions: 9

Compression:

Stored size: 1.22 KB

Contents

<%
  add_gem_component_stylesheet("details")

  open ||= nil
  disable_ga4 ||= false
  @ga4 ||= OpenStruct.new(index_section: 0) unless disable_ga4
  @ga4[:index_section] += 1 unless disable_ga4
  ga4_attributes ||= {}
  local_assigns[:margin_bottom] ||= 3

  unless disable_ga4
    ga4_event = {
      event_name: "select_content",
      type: "detail",
      text: title,
      section: title,
      index_section: @ga4[:index_section],
    }
    ga4_event.merge!(ga4_attributes)
  end

  summary_aria_attributes ||= {}

  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
  component_helper.add_class("gem-c-details govuk-details")
  component_helper.add_data_attribute({ module: "ga4-event-tracker" }) unless disable_ga4
  component_helper.add_data_attribute({ ga4_event: ga4_event }) unless disable_ga4
  component_helper.set_open(open)
%>
<%= tag.details(**component_helper.all_attributes) do %>
  <%= tag.summary class: "govuk-details__summary", aria: summary_aria_attributes do %>
    <span class="govuk-details__summary-text" <% unless disable_ga4 %>data-ga4-expandable<% end %>>
      <%= title %>
    </span>
  <% end %>
  <div class="govuk-details__text">
    <%= yield %>
  </div>
<% 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/_details.html.erb
govuk_publishing_components-51.0.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-50.0.1 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-50.0.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-49.1.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-49.0.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-48.0.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-47.0.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-46.4.0 app/views/govuk_publishing_components/components/_details.html.erb