Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix components test #3220

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Make components pass fixed test
- doesn't seem like important_metadata needed the html_safe on it
- updated YML example to show links rendered correctly
  • Loading branch information
andysellick committed Jun 7, 2024
commit b6ca36bed9cf5fa7090b85474e1382bb44fb8455
12 changes: 9 additions & 3 deletions app/views/components/_contents_list_with_body.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
<% unless block.empty? %>
<%
contents ||= []
sticky_attr = ' data-module="sticky-element-container"'.html_safe if contents.any?
sticky_attr = "sticky-element-container" if contents.any?
%>
<div id="contents" class="app-c-contents-list-with-body"<%= sticky_attr %>>
<%= tag.div(
id: "contents",
class: "app-c-contents-list-with-body",
data: {
module: sticky_attr,
},
) do %>
<% if contents.any? %>
<div class="responsive-bottom-margin">
<%= render 'govuk_publishing_components/components/contents_list', contents: contents %>
Expand All @@ -19,5 +25,5 @@
</div>
</div>
<% end %>
</div>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/components/_important_metadata.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
title = local_assigns[:title]
items = local_assigns[:items] || {}
items = items.reject { |k,v| v.nil? }
items = items.merge(items) { |k,v| Array(v).join(", ").html_safe }
items = items.merge(items) { |k,v| Array(v).join(", ") }
margin_bottom_class = " app-c-important-metadata--bottom-margin" unless local_assigns[:margin_bottom]
-%>
<% if items.any? %>
Expand Down
8 changes: 4 additions & 4 deletions app/views/components/docs/contents_list_with_body.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ examples:
<h3 id="contact">Contact</h3>
<p>Please send written representations about any competition issues to:</p>
<div class="address"><div class="adr org fn"><p>
<br>Competition and Markets Authority
<br>Victoria House
<br>Southampton Row
<br>London
<br>Competition and Markets Authority
<br>Victoria House
<br>Southampton Row
<br>London
<br>WC1B 4AD
<br>
</p></div></div>
Expand Down
6 changes: 3 additions & 3 deletions app/views/components/docs/important_metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ examples:
data:
items:
Many things:
- First thing
- Second thing
- Third thing
- <a href="#">First thing</a>
- <a href="#">Second thing</a>
- <a href="#">Third thing</a>
with_title:
description: Used on statistics announcements to display release date changed information, [see example](https://gov.uk/government/statistics/announcements/museums-and-galleries-monthly-visits--8)
data:
Expand Down
Loading