From 85d7a023a5d3a98c2de67e93734278e6d9fc8a6f Mon Sep 17 00:00:00 2001 From: Dana Cotoran Date: Fri, 28 Jan 2022 17:34:08 +0000 Subject: [PATCH] Support page notification button on consultation Add support for the single page notification buton to the consultation template. The button will not appear until the feature is enabled on pages with this content type. Seeing as the button is always grouped together with the published dates component I created a new `published_dates_with_notification_button` partial to be shared between publications, detailed_guides and consultations. --- app/views/content_items/consultation.html.erb | 6 +----- app/views/content_items/detailed_guide.html.erb | 14 +------------- app/views/content_items/publication.html.erb | 14 +------------- ...blished_dates_with_notification_button.html.erb | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 31 deletions(-) create mode 100644 app/views/shared/_published_dates_with_notification_button.html.erb diff --git a/app/views/content_items/consultation.html.erb b/app/views/content_items/consultation.html.erb index f92143163..5264cd9eb 100644 --- a/app/views/content_items/consultation.html.erb +++ b/app/views/content_items/consultation.html.erb @@ -196,11 +196,7 @@ %> - <%= render 'components/published-dates', { - published: @content_item.published, - last_updated: @content_item.updated, - history: @content_item.history - } %> + <%= render 'shared/published_dates_with_notification_button' %> <%= render 'shared/sidebar_navigation' %> diff --git a/app/views/content_items/detailed_guide.html.erb b/app/views/content_items/detailed_guide.html.erb index dc7f34180..be495fead 100644 --- a/app/views/content_items/detailed_guide.html.erb +++ b/app/views/content_items/detailed_guide.html.erb @@ -115,19 +115,7 @@ <% end %>
- <%= render 'components/published-dates', { - published: @content_item.published, - last_updated: @content_item.updated, - history: @content_item.history, - margin_bottom: 3, - } unless brexit_child_taxon %> - - <%= render 'govuk_publishing_components/components/single_page_notification_button', { - base_path: @content_item.base_path, - js_enhancement: @include_single_page_notification_button_js, - button_location: "bottom", - margin_bottom: 0, - } if @notification_button_visible %> + <%= render 'shared/published_dates_with_notification_button', { brexit_child_taxon: brexit_child_taxon } %>
<% end %> <%= render "govuk_publishing_components/components/print_link", { diff --git a/app/views/content_items/publication.html.erb b/app/views/content_items/publication.html.erb index 689e21a28..7c36ca386 100644 --- a/app/views/content_items/publication.html.erb +++ b/app/views/content_items/publication.html.erb @@ -54,19 +54,7 @@ <% end %> - - <%= render 'components/published-dates', { - published: @content_item.published, - last_updated: @content_item.updated, - history: @content_item.history, - margin_bottom: 3 - } %> - - <%= render 'govuk_publishing_components/components/single_page_notification_button', { - base_path: @content_item.base_path, - js_enhancement: @include_single_page_notification_button_js, - button_location: "bottom", - } if @notification_button_visible %> + <%= render 'shared/published_dates_with_notification_button' %> <%= render 'shared/sidebar_navigation' %> diff --git a/app/views/shared/_published_dates_with_notification_button.html.erb b/app/views/shared/_published_dates_with_notification_button.html.erb new file mode 100644 index 000000000..44450ddcb --- /dev/null +++ b/app/views/shared/_published_dates_with_notification_button.html.erb @@ -0,0 +1,14 @@ +<% brexit_child_taxon ||= nil %> + +<%= render 'components/published-dates', { + published: @content_item.published, + last_updated: @content_item.updated, + history: @content_item.history, + margin_bottom: 3, + } unless brexit_child_taxon %> +<%= render 'govuk_publishing_components/components/single_page_notification_button', { + base_path: @content_item.base_path, + js_enhancement: @include_single_page_notification_button_js, + button_location: "bottom", + margin_bottom: 0, +} if @notification_button_visible %>