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
Apply Subheader component to Members page
Henriette Dargedd780757f7e7
diff --git a/app/components/members/index_page_header_component.html.erb b/app/components/members/index_page_header_component.html.erbindex d8742fbaff8..f86519661c1 100644--- a/app/components/members/index_page_header_component.html.erb+++ b/app/components/members/index_page_header_component.html.erb@@ -2,26 +2,5 @@render(Primer::OpenProject::PageHeader.new) do |header|header.with_title { page_title }header.with_breadcrumbs(breadcrumb_items, selected_item_font_weight: current_breadcrumb_element == page_title ? :bold : :normal)-- header.with_action_button(scheme: :primary,- mobile_icon: :plus,- mobile_label: t('activerecord.models.member'),- size: :medium,- aria: { label: I18n.t(:button_add_member) },- title: I18n.t(:button_add_member),- id: "add-member-button",- data: add_button_data_attributes) do |button|- button.with_leading_visual_icon(icon: :plus)- t('activerecord.models.member')- end-- header.with_action_icon_button(mobile_icon: "filter",- scheme: :default,- icon: "filter",- label: I18n.t(:description_filter),- id: "filter-member-button",- aria: { label: I18n.t(:description_filter) },- class: "toggle-member-filter-link",- data: filter_button_data_attributes)end%>diff --git a/app/components/members/index_page_header_component.rb b/app/components/members/index_page_header_component.rbindex 6c6df07280c..907a6cc2f4e 100644--- a/app/components/members/index_page_header_component.rb+++ b/app/components/members/index_page_header_component.rb@@ -38,25 +38,6 @@ class Members::IndexPageHeaderComponent < ApplicationComponent@project = projectend- def add_button_data_attributes- attributes = {- "members-form-target": "addMemberButton",- action: "members-form#showAddMemberForm",- "test-selector": "member-add-button"- }-- attributes["trigger-initially"] = "true" if params[:show_add_members]-- attributes- end-- def filter_button_data_attributes- {- "members-form-target": "filterMemberButton",- action: "members-form#toggleMemberFilter"- }- end-def breadcrumb_items[{ href: project_overview_path(@project.id), text: @project.name },{ href: project_members_path(@project), text: t(:label_member_plural) },diff --git a/app/components/members/index_sub_header_component.html.erb b/app/components/members/index_sub_header_component.html.erbnew file mode 100644index 00000000000..d982cdf7950--- /dev/null+++ b/app/components/members/index_sub_header_component.html.erb@@ -0,0 +1,22 @@+<%= render(Primer::OpenProject::SubHeader.new) do |subheader|+ subheader.with_filter_button(label: I18n.t(:description_filter),+ id: "filter-member-button",+ aria: { label: I18n.t(:description_filter) },+ class: "toggle-member-filter-link",+ data: filter_button_data_attributes) do+ I18n.t(:description_filter)+ end++ subheader.with_action_button(scheme: :primary,+ aria: { label: I18n.t(:button_add_member) },+ title: I18n.t(:button_add_member),+ id: "add-member-button",+ data: add_button_data_attributes) do |button|+ button.with_leading_visual_icon(icon: :plus)+ t('activerecord.models.member')+ end++ subheader.with_bottom_pane_component do+ render ::Members::UserFilterComponent.new(params, **@members_filter_options)+ end+end %>diff --git a/app/components/members/index_sub_header_component.rb b/app/components/members/index_sub_header_component.rbnew file mode 100644index 00000000000..1ee814e243f--- /dev/null+++ b/app/components/members/index_sub_header_component.rb@@ -0,0 +1,62 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# 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.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++module Members+ # rubocop:disable OpenProject/AddPreviewForViewComponent+ class IndexSubHeaderComponent < ApplicationComponent+ # rubocop:enable OpenProject/AddPreviewForViewComponent+ include ApplicationHelper++ def initialize(project: nil, filter_options: nil)+ super+ @project = project+ @members_filter_options = filter_options+ end++ def add_button_data_attributes+ attributes = {+ "members-form-target": "addMemberButton",+ action: "members-form#showAddMemberForm",+ "test-selector": "member-add-button"+ }++ attributes["trigger-initially"] = "true" if params[:show_add_members]++ attributes+ end++ def filter_button_data_attributes+ {+ "members-form-target": "filterMemberButton",+ action: "members-form#toggleMemberFilter"+ }+ end+ end+enddiff --git a/app/views/members/index.html.erb b/app/views/members/index.html.erbindex a7845472b29..11b53e2f7c4 100644--- a/app/views/members/index.html.erb+++ b/app/views/members/index.html.erb@@ -28,12 +28,11 @@ See COPYRIGHT and LICENSE files for more details.++#%><% html_title t(:label_member_plural) -%>--<div data-controller="members-form"data-application-target="dynamic"><%= render ::Members::IndexPageHeaderComponent.new(project: @project) %>+ <%= render ::Members::IndexSubHeaderComponent.new(project: @project, filter_options: @members_filter_options) %><%= error_messages_for 'member' %>@@ -50,7 +49,6 @@ See COPYRIGHT and LICENSE files for more details.</div><div>- <%= render ::Members::UserFilterComponent.new(params, **@members_filter_options) %><%= render ::Members::TableComponent.new(rows: @members, **@members_table_options) %></div></div>