Skip to content

Commit

Permalink
Fix beta banner
Browse files Browse the repository at this point in the history
Rendering the govuk component in the view helper breaks the styling
because govuk-publishing-components gem relies on said components
being rendered from inside a view.
  • Loading branch information
Laurent Curau committed Apr 22, 2020
1 parent f96247f commit 971943f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
10 changes: 0 additions & 10 deletions app/helpers/phase_label_helper.rb

This file was deleted.

4 changes: 4 additions & 0 deletions app/presenters/content_item_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
<% end %>

<div id="wrapper" class="<%= wrapper_class %>">
<%= 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 %>
Expand Down

0 comments on commit 971943f

Please sign in to comment.