Skip to content

Commit

Permalink
Add browse page helper
Browse files Browse the repository at this point in the history
For business and benefits pages:
- correctly change margin-bottom on header and
- render action links
  • Loading branch information
jon-kirwan committed Nov 13, 2023
1 parent 316c750 commit 80f2158
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/helpers/browse_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module BrowseHelper
SLUGS = %w[benefits business].freeze

def is_matching_slug?(slug)
SLUGS.include?(slug)
end
end
4 changes: 2 additions & 2 deletions app/views/browse/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
} %>
<% end %>

<%= render "shared/browse_header", { margin_bottom: [ "benefits", "business" ].include?(page.slug) ? 7 : 9 } do %>
<%= render "shared/browse_header", { margin_bottom: is_matching_slug?(page.slug) ? 7 : 9 } do %>
<h1 class="browse__heading govuk-heading-xl">
<%= page.title %>
</h1>
Expand All @@ -31,7 +31,7 @@
} %>
<% end %>

<% if [ "benefits", "business" ].include?(page.slug) %>
<% if is_matching_slug?(page.slug) %>
<div class="govuk-width-container">
<div class="govuk-grid-row">
<% if page.slug == "benefits" %>
Expand Down

0 comments on commit 80f2158

Please sign in to comment.