<% add_gem_component_stylesheet("metadata") title ||= "" from ||= [] from = Array(from) part_of ||= [] part_of = Array(part_of) other ||= nil inverse ||= false inverse_compress ||= false direction_class = "" direction_class = " direction-#{direction}" if local_assigns.include?(:direction) component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) component_helper.add_class("gem-c-metadata") component_helper.add_class("direction-#{direction}") if local_assigns.include?(:direction) if inverse component_helper.add_class("gem-c-metadata--inverse") component_helper.add_class("gem-c-metadata--inverse-padded") unless inverse_compress end component_helper.add_data_attribute({ module: "metadata" }) disable_ga4 ||= false ga4_object = { event_name: "navigation", type: "content history", section: "Top", }.to_json unless disable_ga4 %> <%= tag.div(**component_helper.all_attributes) do %> <% if title.present? %> <%= content_tag :div, class: "gem-c-metadata__title" do %> <%= render "govuk_publishing_components/components/heading", { text: sanitize(title), font_size: "m", inverse:, margin_bottom: 0, } %> <% end %> <% end %>
<% if from.any? %>
<%= t("components.metadata.from") %>:
<%= render 'govuk_publishing_components/components/metadata/sentence', items: from, toggle_id: "from-#{SecureRandom.hex(4)}" %>
<% end %> <% if part_of.any? %>
<%= t("components.metadata.part_of") %>:
<%= render 'govuk_publishing_components/components/metadata/sentence', items: part_of, toggle_id: "part-of-#{SecureRandom.hex(4)}" %>
<% end %> <% if local_assigns.include?(:history) %>
<%= t("components.metadata.history") %>:
<%= history %>
<% end %> <% if local_assigns.include?(:first_published) && first_published %>
<%= t("components.metadata.published") %>
<%= first_published %>
<% end %> <% if local_assigns.include?(:last_updated) && last_updated %>
<%= t("components.metadata.last_updated") %>
<%= last_updated %> <% if local_assigns.include?(:see_updates_link) %> — <% end %>
<% end %> <% if other.present? %> <% other.each_with_index do |(title, definition), index| %> <% definition ||= [] definition = Array(definition) %> <% if definition.any? %>
<%= title %>:
data-module="gem-toggle" <% else %> data-module="gem-toggle ga4-link-tracker" data-ga4-track-links-only data-ga4-link="<%= ga4_object %>" <% end%>> <%= render 'govuk_publishing_components/components/metadata/sentence', items: definition, toggle_id: "#{index}-#{SecureRandom.hex(4)}" %>
<% end %> <% end %> <% end %>
<% end %>