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
Extract project settings pageHeader into a separate component
Henriette Darge681dcf29c6e2
diff --git a/app/views/projects/_toolbar.html.erb b/app/components/projects/settings/index_page_header_component.html.erbsimilarity index 59%rename from app/views/projects/_toolbar.html.erbrename to app/components/projects/settings/index_page_header_component.html.erbindex 543e0ea3ce2..7c937f40f55 100644--- a/app/views/projects/_toolbar.html.erb+++ b/app/components/projects/settings/index_page_header_component.html.erb@@ -1,32 +1,3 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 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.--++#%>-<%=render Primer::OpenProject::PageHeader.new do |header|header.with_title { t(:label_information_plural) }@@ -38,12 +9,12 @@ See COPYRIGHT and LICENSE files for more details.if User.current.allowed_in_project?(:add_subprojects, @project)header.with_action_button(scheme: :primary,- mobile_icon: :plus,- mobile_label: t(:label_subproject_new),- aria: { label: t(:label_subproject_new) },- title: t(:label_subproject_new),- tag: :a,- href: new_project_path(parent_id: @project.id)) do |button|+ mobile_icon: :plus,+ mobile_label: t(:label_subproject_new),+ aria: { label: t(:label_subproject_new) },+ title: t(:label_subproject_new),+ tag: :a,+ href: new_project_path(parent_id: @project.id)) do |button|button.with_leading_visual_icon(icon: :plus)t(:label_subproject)end@@ -73,8 +44,11 @@ See COPYRIGHT and LICENSE files for more details.menu.with_item(label:t(:button_copy),href: copy_project_path(@project),- content_arguments: { data: { turbo: false }, },- accesskey: accesskey(:copy),+ content_arguments: {+ data: { turbo: false },+ test_selector: "project-settings--copy"+ },+ accesskey: helpers.accesskey(:copy),) do |item|item.with_leading_visual_icon(icon: :copy)end@@ -85,7 +59,10 @@ See COPYRIGHT and LICENSE files for more details.tag: :a,label: t(:button_archive),href: project_archive_path(@project, status: '', name: @project.name),- content_arguments: { data: { confirm: t('project.archive.are_you_sure', name: @project.name), method: :post, } }+ content_arguments: {+ data: { confirm: t('project.archive.are_you_sure', name: @project.name), method: :post, },+ test_selector: "project-settings--archive"+ }) do |item|item.with_leading_visual_icon(icon: 'lock')end@@ -106,7 +83,10 @@ See COPYRIGHT and LICENSE files for more details.scheme: :danger,label: t(:button_delete),href: confirm_destroy_project_path(@project),- content_arguments: { data: { turbo: false } }+ content_arguments: {+ data: { turbo: false },+ test_selector: "project-settings--delete"+ }) do |item|item.with_leading_visual_icon(icon: :trash)enddiff --git a/app/components/projects/settings/index_page_header_component.rb b/app/components/projects/settings/index_page_header_component.rbnew file mode 100644index 00000000000..a57128ce4f0--- /dev/null+++ b/app/components/projects/settings/index_page_header_component.rb@@ -0,0 +1,39 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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.+# ++++class Projects::Settings::IndexPageHeaderComponent < ApplicationComponent+ include OpPrimer::ComponentHelpers++ def initialize(project:)+ super++ @project = project+ end+enddiff --git a/app/views/projects/settings/general/show.html.erb b/app/views/projects/settings/general/show.html.erbindex c5bc207a347..a52a028bcaa 100644--- a/app/views/projects/settings/general/show.html.erb+++ b/app/views/projects/settings/general/show.html.erb@@ -26,6 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See COPYRIGHT and LICENSE files for more details.++#%>-<%= render partial: 'projects/toolbar' %>+<%= render Projects::Settings::IndexPageHeaderComponent.new(project: @project) %><%= angular_component_tag "opce-project-settings" %>