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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Replace header of meetings index page with Primer::PageHeader
Henriette Dargecc9d6cbe6932
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.erbnew file mode 100644index 00000000000..72e7e701661--- /dev/null+++ b/modules/meeting/app/components/meetings/index_page_header_component.html.erb@@ -0,0 +1,17 @@+<%= render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { page_title }+ header.with_breadcrumbs(breadcrumb_items)+ if render_create_button?+ header.with_action_button(tag: :a,+ href: dynamic_path,+ scheme: :primary,+ mobile_icon: :plus,+ mobile_label: label_text,+ aria: { label: accessibility_label_text },+ title: accessibility_label_text,+ id: id) do |button|+ button.with_leading_visual_icon(icon: :plus)+ label_text+ end+ end+end %>diff --git a/modules/meeting/app/components/meetings/add_button_component.rb b/modules/meeting/app/components/meetings/index_page_header_component.rbsimilarity index 66%rename from modules/meeting/app/components/meetings/add_button_component.rbrename to modules/meeting/app/components/meetings/index_page_header_component.rbindex 7b5a3afbfe2..a6d3b01aad2 100644--- a/modules/meeting/app/components/meetings/add_button_component.rb+++ b/modules/meeting/app/components/meetings/index_page_header_component.rb@@ -2,7 +2,7 @@# -- copyright# OpenProject is an open source project management software.-# Copyright (C) 2023 the OpenProject GmbH+# Copyright (C) 2010-2024 the OpenProject GmbH## This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License version 3.@@ -27,20 +27,27 @@## See COPYRIGHT and LICENSE files for more details.# ++-#module Meetings- class AddButtonComponent < ::AddButtonComponent- def render?- if current_project- User.current.allowed_in_project?(:create_meetings, current_project)+ class IndexPageHeaderComponent < ApplicationComponent+ include OpPrimer::ComponentHelpers+ include ApplicationHelper++ def initialize(project: nil)+ super+ @project = project+ end++ def render_create_button?+ if @project+ User.current.allowed_in_project?(:create_meetings, @project)elseUser.current.allowed_in_any_project?(:create_meetings)endenddef dynamic_path- polymorphic_path([:new, current_project, :meeting])+ polymorphic_path([:new, @project, :meeting])enddef id@@ -54,5 +61,22 @@ module Meetingsdef label_textI18n.t(:label_meeting)end++ def page_title+ I18n.t(:label_meeting_plural)+ end++ def breadcrumb_items+ [parent_element,+ page_title]+ end++ def parent_element+ if @project+ { href: project_overview_path(@project.id), text: @project.name }+ else+ { href: home_path, text: I18n.t(:label_home) }+ end+ endendenddiff --git a/modules/meeting/app/views/meetings/index.html.erb b/modules/meeting/app/views/meetings/index.html.erbindex 566bd2584ed..cde9cfb053f 100644--- a/modules/meeting/app/views/meetings/index.html.erb+++ b/modules/meeting/app/views/meetings/index.html.erb@@ -28,9 +28,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><% html_title t(:label_meeting_plural) %>-<%= toolbar title: t(:label_meeting_plural) do %>- <%= render Meetings::AddButtonComponent.new(current_project: @project) %>-<% end %>+<%= render(Meetings::IndexPageHeaderComponent.new(project: @project)) %><%= render(Meetings::MeetingFiltersComponent.new(query: @query, project: @project, output_format: 'json')) %>