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
[#55960] Add the "Enabled in Projects" tab in storage edit view
Judith Roth50a605b5ac2e
diff --git a/app/components/settings/project_custom_fields/edit_form_header_component.html.erb b/app/components/settings/project_custom_fields/edit_form_header_component.html.erbindex d77783af62a..d4802f1b25f 100644--- a/app/components/settings/project_custom_fields/edit_form_header_component.html.erb+++ b/app/components/settings/project_custom_fields/edit_form_header_component.html.erb@@ -43,7 +43,7 @@ See COPYRIGHT and LICENSE files for more details.selected: project_custom_field_project_mappings_selected?,href: project_mappings_admin_settings_project_custom_field_path(@custom_field)) do |tab|- tab.with_text { I18n.t("projects.settings.project_custom_fields.project_mappings.header") }+ tab.with_text { t(:label_project_mappings) }endendenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex ca2765992e2..c1211ea786c 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -337,8 +337,6 @@ Project attributes and sections are defined in the <a href=%{admin_settings_url}new_project_mapping_form:add_projects: Add projectsinclude_sub_projects: Include sub-projects- project_mappings:- header: Enabled in projectstypes:no_results_title_text: There are currently no types available.form:@@ -2299,6 +2297,7 @@ Project attributes and sections are defined in the <a href=%{admin_settings_url}label_project_latest: "Latest projects"label_project_default_type: "Allow empty type"label_project_hierarchy: "Project hierarchy"+ label_project_mappings: "Enabled in projects"label_project_new: "New project"label_project_plural: "Projects"label_project_list_plural: "Project lists"diff --git a/modules/storages/app/components/storages/admin/edit_form_header_component.html.erb b/modules/storages/app/components/storages/admin/edit_form_header_component.html.erbindex bb456bdc598..7439ade12a6 100644--- a/modules/storages/app/components/storages/admin/edit_form_header_component.html.erb+++ b/modules/storages/app/components/storages/admin/edit_form_header_component.html.erb@@ -43,5 +43,20 @@ See COPYRIGHT and LICENSE files for more details.button.with_leading_visual_icon(icon: :trash)I18n.t("button_delete")end+ header.with_tab_nav(label: nil, test_selector: :project_attribute_detail_header) do |tab_nav|+ tab_nav.with_tab(+ selected: tab_selected?(:edit),+ href: edit_admin_settings_storage_path(@storage)+ ) do |tab|+ tab.with_text { t(:label_details) }+ end++ tab_nav.with_tab(+ selected: tab_selected?(:project_mappings),+ href: project_mappings_admin_settings_storage_path(@storage)+ ) do |tab|+ tab.with_text { t(:label_project_mappings) }+ end+ endend%>diff --git a/modules/storages/app/components/storages/admin/edit_form_header_component.rb b/modules/storages/app/components/storages/admin/edit_form_header_component.rbindex 21dcae49cf1..f6a923e06e4 100644--- a/modules/storages/app/components/storages/admin/edit_form_header_component.rb+++ b/modules/storages/app/components/storages/admin/edit_form_header_component.rb@@ -29,9 +29,20 @@module Storagesmodule Adminclass EditFormHeaderComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent- def initialize(storage:)+ TAB_NAVS = %i[+ edit+ project_mappings+ ].freeze++ def initialize(storage:, selected:)super@storage = storage+ @selected = selected+ end++ def tab_selected?(tab_name)+ TAB_NAVS.include?(tab_name) &&+ tab_name == @selectedenddef label_storage_name_with_provider_labeldiff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rbindex bacb294a174..f084e2ffb1e 100644--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb@@ -46,7 +46,7 @@ class Storages::Admin::StoragesController < ApplicationControllerbefore_action :require_adminbefore_action :find_model_object,only: %i[show_oauth_application destroy edit edit_host confirm_destroy update- change_health_notifications_enabled replace_oauth_application]+ change_health_notifications_enabled replace_oauth_application project_mappings]before_action :ensure_valid_provider_type_selected, only: %i[select_provider]before_action :require_ee_token_for_one_drive, only: %i[select_provider]@@ -208,6 +208,8 @@ class Storages::Admin::StoragesController < ApplicationControllerendend+ def project_mappings; end+def default_breadcrumb; enddef show_local_breadcrumbdiff --git a/modules/storages/app/views/storages/admin/storages/edit.html.erb b/modules/storages/app/views/storages/admin/storages/edit.html.erbindex 83eb999e4e7..8d8e7f2d2d1 100644--- a/modules/storages/app/views/storages/admin/storages/edit.html.erb+++ b/modules/storages/app/views/storages/admin/storages/edit.html.erb@@ -36,7 +36,8 @@ See COPYRIGHT and LICENSE files for more details.) do %><%=render(Storages::Admin::EditFormHeaderComponent.new(- storage: @storage+ storage: @storage,+ selected: :edit))%><% end %>diff --git a/modules/storages/app/views/storages/admin/storages/project_mappings.html.erb b/modules/storages/app/views/storages/admin/storages/project_mappings.html.erbnew file mode 100644index 00000000000..7dbce914141--- /dev/null+++ b/modules/storages/app/views/storages/admin/storages/project_mappings.html.erb@@ -0,0 +1,36 @@+<%#-- copyright+OpenProject is an open source project management software.+Copyright (C) 2012-2023 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(Storages::Admin::EditFormHeaderComponent.new(+ storage: @storage,+ selected: :project_mappings+ )+ )+%>diff --git a/modules/storages/config/routes.rb b/modules/storages/config/routes.rbindex 04b2d533977..3654c773320 100644--- a/modules/storages/config/routes.rb+++ b/modules/storages/config/routes.rb@@ -58,6 +58,7 @@ Rails.application.routes.draw dopatch :change_health_notifications_enabledget :confirm_destroydelete :replace_oauth_application+ get :project_mappingsendget :upsale, on: :collection