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

WIP merge hardcoded bits content into content items #3775

Closed
wants to merge 5 commits into from
Closed
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
6 changes: 6 additions & 0 deletions app/models/content_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
links["content_extensions"] = content_extensions
content_item_hash["links"] = links
end
puts content_item_hash

Check failure on line 24 in app/models/content_item.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Rails/Output: Do not write to stdout. Use Rails's logger if you want to log.
new(content_item_hash)
end

Expand All @@ -35,6 +35,12 @@
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 @@ -3,7 +3,8 @@
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 %>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are multiple "hub" like pages that behave a bit like parts, it'd probably be better to render this new type of content in frontend, that already handles parts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming we're adorning the existing organisation pages with some extra components here. Appreciate that might not be the approach we end up taking though.

<% if @organisation.is_no_10? %>
<%= render partial: 'latest_news' %>
<%= render partial: 'featured_news_small' %>
Expand Down
Loading