Skip to content

Commit

Permalink
fix showing breadcrumbs in meetings overview page
Browse files Browse the repository at this point in the history
  • Loading branch information
bsatarnejad committed Oct 9, 2024
1 parent b786e47 commit d73125d
Showing 1 changed file with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,32 @@ def page_title
end

def breadcrumb_items
[parent_element,
page_title]
[
{ href: home_path, text: helpers.organization_name },
*([{ href: project_overview_path(@project.id), text: @project.name }] if @project.present?),
{ href: meetings_path(@project), text: I18n.t(:label_meeting_plural) },
current_breadcrumb_element
]
end

def parent_element
if @project.present?
{ href: project_overview_path(@project.id), text: @project.name }
def current_breadcrumb_element
if current_section
selected_menu = current_section.children.find(&:selected)
if current_section.header.present?
I18n.t("menus.breadcrumb.nested_element", section_header: current_section.header, title: selected_menu.title).html_safe
else
selected_menu.title
end
else
{ href: home_path, text: helpers.organization_name }
page_title
end
end

def current_section
return @current_section if defined?(@current_section)

meetings_menu = Meetings::Menu.new(params:)
@current_section = meetings_menu.menu_items.find { |section| section.children.any?(&:selected) }
end
end
end

0 comments on commit d73125d

Please sign in to comment.