Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Show left hand selection in the PageHeader for Meetings

Henriette Darge7185ef607c70
diff --git a/app/menus/submenu.rb b/app/menus/submenu.rb
index 57a93f773b3..8909c15f32f 100644
--- a/app/menus/submenu.rb
+++ b/app/menus/submenu.rb
@@ -56,6 +56,8 @@ class Submenu
return item if item.selected
end
end
+
+ nil
end
def starred_queries
diff --git a/modules/meeting/app/components/meetings/index_page_header_component.html.erb b/modules/meeting/app/components/meetings/index_page_header_component.html.erb
index 9b6787bd672..7b455f819b9 100644
--- a/modules/meeting/app/components/meetings/index_page_header_component.html.erb
+++ b/modules/meeting/app/components/meetings/index_page_header_component.html.erb
@@ -1,4 +1,4 @@
<%= render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title { page_title }
- header.with_breadcrumbs(breadcrumb_items)
+ header.with_breadcrumbs(breadcrumb_items, selected_item_font_weight: section_present? ? :normal : :bold)
end %>
diff --git a/modules/meeting/app/components/meetings/index_page_header_component.rb b/modules/meeting/app/components/meetings/index_page_header_component.rb
index c32223b61a1..aca17d620c4 100644
--- a/modules/meeting/app/components/meetings/index_page_header_component.rb
+++ b/modules/meeting/app/components/meetings/index_page_header_component.rb
@@ -38,12 +38,18 @@ module Meetings
end
def page_title
- I18n.t(:label_meeting_plural)
+ if current_item.present?
+ current_item.title
+ else
+ I18n.t(:label_meeting_plural)
+ end
end
def breadcrumb_items
[parent_element,
- page_title]
+ { href: url_for({ controller: "meetings", action: :index, project_id: @project }),
+ text: I18n.t(:label_meeting_plural) },
+ current_breadcrumb_element]
end
def parent_element
@@ -53,5 +59,33 @@ module Meetings
{ href: home_path, text: helpers.organization_name }
end
end
+
+ def current_breadcrumb_element
+ if section_present?
+ I18n.t("menus.breadcrumb.nested_element", section_header: current_section.header, title: page_title).html_safe
+ else
+ page_title
+ end
+ end
+
+ def section_present?
+ current_section && current_section.header.present?
+ end
+
+ def current_section
+ return @current_section if defined?(@current_section)
+
+ @current_section = Meetings::Menu
+ .new(project: @project, params:)
+ .selected_menu_group
+ end
+
+ def current_item
+ return @current_item if defined?(@current_item)
+
+ @current_item = Meetings::Menu
+ .new(project: @project, params:)
+ .selected_menu_item
+ end
end
end