From d8ae1c08f9fb800206d8e32cc21d76433d96febc Mon Sep 17 00:00:00 2001 From: Steve Laing Date: Wed, 17 Jan 2018 17:56:08 +0000 Subject: [PATCH] Move detailed guides to universal layout --- app/presenters/detailed_guide_presenter.rb | 22 ++++-- .../content_items/detailed_guide.html.erb | 76 +++++++++--------- test/integration/detailed_guide_test.rb | 78 +++++++++++++++---- 3 files changed, 115 insertions(+), 61 deletions(-) diff --git a/app/presenters/detailed_guide_presenter.rb b/app/presenters/detailed_guide_presenter.rb index 107a3d7600..52c2a814ec 100644 --- a/app/presenters/detailed_guide_presenter.rb +++ b/app/presenters/detailed_guide_presenter.rb @@ -12,14 +12,6 @@ def title_and_context end end - def related_guides - links("related_guides") - end - - def related_mainstream_content - links("related_mainstream_content") - end - def image content_item["details"]["image"]["url"] if content_item["details"]["image"] end @@ -30,8 +22,22 @@ def document_footer end end + def related_navigation + nav = super + nav[:related_items] += related_links("related_mainstream_content") + nav[:related_guides] = related_links("related_guides") + nav + end + private + def related_links(key) + raw_links = content_item["links"] + guides = raw_links.fetch(key, []) + guides.map { |g| { text: g["title"], path: g["base_path"] } } + end + + def related_guides_title I18n.t('detailed_guide.related_guides') end diff --git a/app/views/content_items/detailed_guide.html.erb b/app/views/content_items/detailed_guide.html.erb index 56fda7f464..1c30d94ab5 100644 --- a/app/views/content_items/detailed_guide.html.erb +++ b/app/views/content_items/detailed_guide.html.erb @@ -1,45 +1,49 @@
- <%= render 'govuk_component/title', @content_item.title_and_context %> + <%= render 'govuk_component/title', + title: @content_item.title, + average_title_length: "long" %>
-
- <%= render 'components/translation-nav', translations: @content_item.available_translations %> - <% if @content_item.image.present? %> - <%= image_tag @content_item.image, class: "logo-image" %> - <% end %> -
-
-<%= render 'components/notice', @content_item.withdrawal_notice_component %> -<%= render 'shared/metadata', content_item: @content_item %> -<%= render 'shared/history_notice', content_item: @content_item %> -<%= render 'govuk_component/lead_paragraph', text: @content_item.description %> - -