-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- simplify and fix the code to display attachments on publication/form pages - move most of the code into the presenter, to reduce ambiguity - pass only one thing to the attachments_list component - update tests
- Loading branch information
1 parent
ca194ef
commit 1af04c1
Showing
4 changed files
with
26 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
<% | ||
attachments ||= nil | ||
featured_attachments ||= [] | ||
attachment_details = featured_attachments.filter_map { |id| @content_item&.attachment_details(id) } | ||
%> | ||
<section id="<%= title.parameterize %>"> | ||
<%= render 'govuk_publishing_components/components/heading', | ||
text: title, | ||
mobile_top_margin: true | ||
%> | ||
<% if attachment_details.length > 0 %> | ||
<% if attachments_for_components.any? %> | ||
<section id="<%= title.parameterize %>"> | ||
<%= render 'govuk_publishing_components/components/heading', | ||
text: title, | ||
mobile_top_margin: true | ||
%> | ||
<% add_gem_component_stylesheet("details") %> | ||
<% attachment_details.each do |details| %> | ||
<% attachments_for_components.each do |details| %> | ||
<%= render 'govuk_publishing_components/components/attachment', { | ||
heading_level: 3, | ||
attachment: details, | ||
margin_bottom: 6 | ||
} %> | ||
<% end %> | ||
<% end %> | ||
</section> | ||
</section> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters