Skip to content

Commit

Permalink
Render content extensions
Browse files Browse the repository at this point in the history
... todo - actually render them
  • Loading branch information
richardTowers committed Sep 23, 2024
1 parent 4eee37e commit a3d52bb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/models/content_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ def initialize(content_item_data)
end
end

%i[content_extensions].each do |field|
define_method field do
(@content_item_data["links"] || {})[field.to_s]
end
end

def details
@content_item_data["details"] || {}
end
Expand Down
1 change: 1 addition & 0 deletions app/models/organisation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Organisation
include ActiveModel::Model

attr_reader :content_item

Check failure on line 6 in app/models/organisation.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Layout/EmptyLinesAroundAttributeAccessor: Add an empty line after attribute accessor. (https://rubystyle.guide#empty-lines-around-attribute-accessor)
delegate :content_extensions, to: :content_item

HMCTS_CONTENT_ID = "6f757605-ab8f-4b62-84e4-99f79cf085c2".freeze

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h2 class="govuk-heading-m">TODO - render the hero image!</h2>
<pre><code><%= YAML.dump(content_extension) %></code></pre>
4 changes: 4 additions & 0 deletions app/views/organisations/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
schema: :organisation,
content_item: @organisation.content_item.content_item_data %>
<% @organisation.content_extensions&.each do |content_extension| %>
<%= render partial: "content_extension_#{content_extension["document_type"]}", locals: { content_extension: } %>
<% end %>
<% if @organisation.is_no_10? %>
<%= render partial: 'latest_news' %>
<%= render partial: 'featured_news_small' %>
Expand Down

0 comments on commit a3d52bb

Please sign in to comment.