Skip to content

Commit

Permalink
Add lang attribute option to documents list component
Browse files Browse the repository at this point in the history
  • Loading branch information
owenatgov committed Aug 21, 2020
1 parent f87ecf2 commit 7cd2289
Showing 1 changed file with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,24 @@

<% if item[:metadata] %>
<ul class="gem-c-document-list__item-metadata">
<% item[:metadata].compact.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 %>
<% item[:metadata].compact.each do |item_metadata_key, item_metadata_value| %>
<% if !item_metadata_key.to_s.eql?("locale") %>
<% lang = item[:metadata][:locale].present? && item[:metadata][:locale][item_metadata_key].present? ? item[:metadata][:locale][item_metadata_key] : nil %>

<%= content_tag(
:li, item_metadata_value,
class: "gem-c-document-list__attribute",
lang: lang
) do %>
<% 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 %>
<% end %>
</li>
<% end %>
<% end %>
</ul>
<% end %>
Expand Down

0 comments on commit 7cd2289

Please sign in to comment.