diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index bc20637d1..8bdaabee1 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -6,6 +6,7 @@ //= require govuk_publishing_components/components/govspeak //= require govuk_publishing_components/components/print-link //= require govuk_publishing_components/components/radio +//= require govuk_publishing_components/components/single-page-notification-button //= require govuk_publishing_components/components/step-by-step-nav //= require_tree ./modules diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index c88216d2f..a65851cc5 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -42,6 +42,7 @@ $govuk-new-link-styles: true; @import 'govuk_publishing_components/components/radio'; @import 'govuk_publishing_components/components/related-navigation'; @import 'govuk_publishing_components/components/share-links'; +@import 'govuk_publishing_components/components/single-page-notification-button'; @import 'govuk_publishing_components/components/step-by-step-nav'; @import 'govuk_publishing_components/components/step-by-step-nav-header'; @import 'govuk_publishing_components/components/step-by-step-nav-related'; diff --git a/app/controllers/content_items_controller.rb b/app/controllers/content_items_controller.rb index 8f93584eb..7ba6b1b89 100644 --- a/app/controllers/content_items_controller.rb +++ b/app/controllers/content_items_controller.rb @@ -134,6 +134,10 @@ def render_template return end + # use these and `@content_item.base_path` in the template + @notification_button_visible = in_single_page_notifications_trial? + @include_single_page_notification_button_js = account_session_header.present? + request.variant = :print if params[:variant] == "print" respond_to do |format| @@ -205,6 +209,13 @@ def error_redirect(exception) def set_account_vary_header # Override the default from GovukPersonalisation::ControllerConcern so pages are cached on each flash message # variation, rather than caching pages per user - response.headers["Vary"] = [response.headers["Vary"], "GOVUK-Account-Session-Flash"].compact.join(", ") + response.headers["Vary"] = [response.headers["Vary"], "GOVUK-Account-Session-Exists", "GOVUK-Account-Session-Flash"].compact.join(", ") + end + + def in_single_page_notifications_trial? + %w[ + /government/publications/open-standards-for-government + /government/publications/identity-proofing-and-verification-of-an-individual + ].include? @content_item.base_path end end diff --git a/app/views/components/_published-dates.html.erb b/app/views/components/_published-dates.html.erb index d25e57e50..98caa7b43 100644 --- a/app/views/components/_published-dates.html.erb +++ b/app/views/components/_published-dates.html.erb @@ -4,10 +4,13 @@ history = Array(history) last_updated ||= false link_to_history ||= false - history_class = "app-c-published-dates--history" if history.any? + shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) + classes = %w(app-c-published-dates) + classes << "app-c-published-dates--history" if history.any? + classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom] %> <% if published || last_updated %> -