-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add footer and sidebar shared partials
- Add code in Factory to rejig links into the desired internal format
- Loading branch information
Showing
3 changed files
with
24 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
class ContentItemFactory | ||
def self.build(content_hash) | ||
content_hash["links"]["ordered_related_items"] = ordered_related_items(content_hash["links"]) if content_hash["links"] | ||
|
||
content_item_class(content_hash).new(content_hash) | ||
end | ||
|
||
def self.content_item_class(_content_hash) | ||
ContentItem | ||
end | ||
|
||
def self.ordered_related_items(links) | ||
return [] if links["ordered_related_items_overrides"].present? | ||
|
||
links["ordered_related_items"].presence || links.fetch( | ||
"suggested_ordered_related_items", [] | ||
) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<% @contextual_footer = capture do %> | ||
<%= render 'govuk_publishing_components/components/contextual_footer', content_item: @content_item.to_h %> | ||
<% end %> | ||
<% if @contextual_footer.present? %> | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<%= @contextual_footer %> | ||
</div> | ||
</div> | ||
<% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="govuk-grid-column-one-third"> | ||
<%= render 'govuk_publishing_components/components/contextual_sidebar', content_item: @content_item.to_h %> | ||
</div> |