Sha256: d617e57477d613a672721561d7c60b0c8dfd16f4407e97ce39fc02369a4ced85

Contents?: true

Size: 1.84 KB

Versions: 6

Compression:

Stored size: 1.84 KB

Contents

<%
  items ||= []
  margin_top_class = " gem-c-document-list--top-margin" if local_assigns[:margin_top]
  margin_bottom_class = " gem-c-document-list--bottom-margin" if local_assigns[:margin_bottom]
  title_with_context_class = " gem-c-document-list__item-title--context"

  brand ||= false
  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
%>
<% if items.any? %>
  <ol class="gem-c-document-list<%= margin_bottom_class %><%= margin_top_class %> <%= brand_helper.brand_class %>">
    <% items.each do |item| %>
      <li class="gem-c-document-list__item">
        <%=
          link_to(
            item[:link][:text],
            item[:link][:path],
            data: item[:link][:data_attributes],
            class: "gem-c-document-list__item-title #{brand_helper.color_class} #{title_with_context_class if item[:link][:context]}"
          )
        %>

        <% if item[:link][:context] %>
          <span class="gem-c-document-list__item-context"><%= item[:link][:context] %></span>
        <% end %>

        <% if item[:link][:description] %>
          <p class="gem-c-document-list__item-description" ><%= item[:link][:description] %></p>
        <% end %>

        <% if item[:metadata] %>
          <ul class="gem-c-document-list__item-metadata">
            <% item[:metadata].each do |item_metadata_key, item_metadata_value| %>
              <li class="gem-c-document-list__attribute">
                <% if item_metadata_key.to_s.eql?("public_updated_at") %>
                  <time datetime="<%= item_metadata_value.iso8601 %>">
                    <%= l(item_metadata_value, format: '%e %B %Y') %>
                  </time>
                <% else %>
                  <%= item_metadata_value %>
                <% end %>
              </li>
            <% end %>
          </ul>
        <% end %>
      </li>
    <% end %>
  </ol>
<% end %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
govuk_publishing_components-9.12.2 app/views/govuk_publishing_components/components/_document_list.html.erb
govuk_publishing_components-9.12.1 app/views/govuk_publishing_components/components/_document_list.html.erb
govuk_publishing_components-9.12.0 app/views/govuk_publishing_components/components/_document_list.html.erb
govuk_publishing_components-9.11.0 app/views/govuk_publishing_components/components/_document_list.html.erb
govuk_publishing_components-9.10.0 app/views/govuk_publishing_components/components/_document_list.html.erb
govuk_publishing_components-9.9.1 app/views/govuk_publishing_components/components/_document_list.html.erb