Skip to content

Commit

Permalink
Align phase banner on service manual homepage
Browse files Browse the repository at this point in the history
Add new `service_manual_homepage?` presenter method.

When on the service_manual_homepage, the phase banner will be wrapped in a div element with the `govuk-width-container` class to align it with the rest of the content on the page.

The service manual homepage layout is different from the rest of the service manual as it contains an app-hero banner that needs to span the full width of the page with a blue background, but we still want the phase banner to be contained.
  • Loading branch information
MartinJJones committed Aug 9, 2024
1 parent b8759f9 commit e604b37
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/presenters/content_item_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ def service_manual?
false
end

def service_manual_homepage?
false
end

def render_guide_as_single_page?
# /how-to-vote
content_id == "9315bc67-33e7-42e9-8dea-e022f56dabfa" && voting_is_open?
Expand Down
4 changes: 4 additions & 0 deletions app/presenters/service_manual_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def service_manual?
true
end

def service_manual_homepage?
content_item["document_type"] == "service_manual_homepage"
end

def show_phase_banner?
false
end
Expand Down
6 changes: 6 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
<%= render 'govuk_publishing_components/components/phase_banner', phase: @content_item.phase %>
<% end %>
<% if @content_item.service_manual? %>
<% if @content_item.service_manual_homepage? %>
<div class="govuk-width-container">
<%= render_phase_label @content_item, content_for(:phase_message) %>
</div>
<% else %>
<%= render_phase_label @content_item, content_for(:phase_message) %>
<% end %>
<% end %>

<% if @content_item.show_default_breadcrumbs? %>
Expand Down

0 comments on commit e604b37

Please sign in to comment.