<% items ||= [] classes = "gem-c-document-list" classes << " gem-c-document-list--top-margin" if local_assigns[:margin_top] classes << " gem-c-document-list--bottom-margin" if local_assigns[:margin_bottom] classes << " gem-c-document-list--no-underline" if local_assigns[:remove_underline] within_multitype_list ||= false within_multitype_list_class = " gem-c-document-list__multi-list" if within_multitype_list brand ||= false brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand) %> <% def document(item, brand_helper) %> <% title_with_context_class = " gem-c-document-list__item-title--context" %> <% if item[:highlight] && item[:highlight_text] %>

<%= item[:highlight_text] %>

<% end %> <%= item_classes = "gem-c-document-list__item-title #{brand_helper.color_class} #{title_with_context_class if item[:link][:context]}" if item[:link][:path] link_to( item[:link][:text], item[:link][:path], data: item[:link][:data_attributes], class: "#{item_classes} gem-c-document-list__item-link", ) else content_tag( "span", item[:link][:text], data: item[:link][:data_attributes], class: item_classes, ) end %> <% if item[:link][:context] %> <%= item[:link][:context] %> <% end %> <% if item[:link][:description] %>

<%= item[:link][:description] %>

<% end %> <% if item[:metadata] %> <% end %> <% if item[:subtext] %>

<%= item[:subtext] %>

<% end %> <% end %> <% if items.any? %> <% unless within_multitype_list || items.one? %>
    <% end %> <% items.each do |item| %> <% highlight_class = " gem-c-document-list__item--highlight" if item[:highlight] %> <% if items.one? %> <% document(item, brand_helper) %> <% else %>
  1. <% document(item, brand_helper) %>
  2. <% end %> <% end %> <% unless within_multitype_list %>
<% end %> <% end %>