Sha256: 5aee8188cccca187d2964f572c702017f9b581f4fd729eed60467e9b4c1d40f3

Contents?: true

Size: 1.38 KB

Versions: 32

Compression:

Stored size: 1.38 KB

Contents

<%
  add_gem_component_stylesheet("details")

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

  margin_bottom ||= 3
  css_classes = %w(gem-c-details govuk-details)
  css_classes << shared_helper.get_margin_bottom

  details_data_attributes = {}
  details_data_attributes[:module] = 'govuk-details gem-details'
  details_data_attributes[:module] = 'govuk-details gem-details ga4-event-tracker' unless disable_ga4

  data_attributes ||= {}
  data_attributes[:details_track_click] = ''
  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)
    data_attributes[:ga4_event] = ga4_event
  end

  summary_aria_attributes ||= {}
%>
<%= tag.details class: css_classes, data: details_data_attributes, open: open do %>
  <%= tag.summary class: "govuk-details__summary", data: data_attributes, 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

32 entries across 32 versions & 1 rubygems

Version Path
govuk_publishing_components-39.2.5 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-39.2.4 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-39.2.3 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-39.2.2 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-39.2.1 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-39.2.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-39.1.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-39.0.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-38.4.2 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-38.1.1 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-38.1.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-38.0.1 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-38.0.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-37.10.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-37.9.1 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-37.9.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-37.8.1 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-37.8.0 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-37.7.1 app/views/govuk_publishing_components/components/_details.html.erb
govuk_publishing_components-37.7.0 app/views/govuk_publishing_components/components/_details.html.erb