Skip to content

Commit

Permalink
Broke navigation menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrett committed Feb 1, 2024
1 parent c4bb342 commit 1ea3672
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base

include Pundit::Authorization

helper_method :group
helper_method :menu_item

def check
render json: { status: "OK", version: release_version, sha: ENV["SHA"], environment: Rails.env }, status: :ok
Expand All @@ -26,7 +26,7 @@ def content
@content ||= Rails.configuration.content
end

def group
def menu_item
:home
end

Expand Down
18 changes: 10 additions & 8 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ def show; end

private

def menu_item
cms_path_array.first
end

def page_params
params.permit(:cms_path)
end
Expand Down Expand Up @@ -39,13 +43,11 @@ def page_name
end

def load_page(lookup_page: page_name)
if lookup_page.present?
page_attributes = content.send(lookup_page)
@page = if page_attributes
Page.new(page_attributes)
else
PageDelegator.new(ContentPage.find_by_slug(page_name))
end
end
page_attributes = content.send(lookup_page || :home)
@page = if page_attributes
Page.new(page_attributes)
else
PageDelegator.new(ContentPage.find_by_slug(page_name))
end
end
end
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def navigation
header.with_navigation_item(
text: item[:menu_title],
href: ["/", item[:parent_path], item[:slug]].join("/").squeeze("/"),
active: key == group&.to_sym,
active: key == menu_item&.to_sym,
classes: %w[dfe-header__navigation-item],
)
end
Expand Down

0 comments on commit 1ea3672

Please sign in to comment.