%
add_gem_component_stylesheet("metadata")
from ||= []
from = Array(from)
part_of ||= []
part_of = Array(part_of)
other ||= nil
inverse ||= false
direction_class = ""
direction_class = " direction-#{direction}" if local_assigns.include?(:direction)
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
classes = %w(gem-c-metadata)
classes << "direction-#{direction}" if local_assigns.include?(:direction)
classes << "gem-c-metadata--inverse" if inverse
classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
%>
<%= content_tag :div, class: classes, data: { module: "gem-toggle metadata" } do %>
<% 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) %>
—
<%= t("components.metadata.see_all_updates") %>
<% end %>
<% end %>
<% if other.present? %>
<% other.each_with_index do |(title, definition), index| %>
<%
definition ||= []
definition = Array(definition)
%>
<% if definition.any? %>
- <%= title %>:
-
<%= render 'govuk_publishing_components/components/metadata/sentence', items: definition, toggle_id: "#{index}-#{SecureRandom.hex(4)}" %>
<% end %>
<% end %>
<% end %>
<% end %>