diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 057617338..dab678275 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -29,6 +29,7 @@ $govuk-use-legacy-palette: false; @import 'govuk_publishing_components/components/metadata'; @import 'govuk_publishing_components/components/notice'; @import 'govuk_publishing_components/components/organisation-logo'; +@import 'govuk_publishing_components/components/phase-banner'; @import 'govuk_publishing_components/components/previous-and-next-navigation'; @import 'govuk_publishing_components/components/radio'; @import 'govuk_publishing_components/components/related-navigation'; diff --git a/app/helpers/phase_label_helper.rb b/app/helpers/phase_label_helper.rb deleted file mode 100644 index e66107fd6..000000000 --- a/app/helpers/phase_label_helper.rb +++ /dev/null @@ -1,10 +0,0 @@ -module PhaseLabelHelper - def render_phase_label(presented_object, message) - if presented_object.respond_to?(:phase) && %w(alpha beta).include?(presented_object.phase) - locals = {} - locals[:message] = message if message.present? - - render "govuk_publishing_components/components/phase_banner", locals.merge(phase: presented_object.phase) - end - end -end diff --git a/app/presenters/content_item_presenter.rb b/app/presenters/content_item_presenter.rb index 7c18a4c57..82ce6f8dc 100644 --- a/app/presenters/content_item_presenter.rb +++ b/app/presenters/content_item_presenter.rb @@ -81,6 +81,10 @@ def cache_control_public? !content_item.cache_control.private? end + def show_phase_banner? + phase.in?(%w[alpha beta]) + end + private def display_date(timestamp, format = "%-d %B %Y") diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 05bb46a0d..e79b26dc6 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -35,7 +35,9 @@ <% end %>
- <%= render_phase_label @content_item, content_for(:phase_message) %> + <% if @content_item.show_phase_banner? %> + <%= render 'govuk_publishing_components/components/phase_banner', phase: @content_item.phase %> + <% end %> <% if @content_item.try(:back_link) %> <%= render 'govuk_publishing_components/components/back_link', href: @content_item.back_link %>