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
[Op#57515]: avail custom field projects list
Kabiru Mwenjad1c45cd27521
diff --git a/app/controllers/admin/custom_fields/custom_field_projects_controller.rb b/app/controllers/admin/custom_fields/custom_field_projects_controller.rbindex 99b51b37db2..d392aedde22 100644--- a/app/controllers/admin/custom_fields/custom_field_projects_controller.rb+++ b/app/controllers/admin/custom_fields/custom_field_projects_controller.rb@@ -48,6 +48,12 @@ class Admin::CustomFields::CustomFieldProjectsController < ApplicationControllerendend+ def default_breadcrumb; end++ def show_local_breadcrumb+ false+ end+privatedef find_model_object(object_id = :custom_field_id)diff --git a/app/views/admin/custom_fields/custom_field_projects/index.html.erb b/app/views/admin/custom_fields/custom_field_projects/index.html.erbindex 2c081b199f4..7bf383a3184 100644--- a/app/views/admin/custom_fields/custom_field_projects/index.html.erb+++ b/app/views/admin/custom_fields/custom_field_projects/index.html.erb@@ -38,8 +38,8 @@ See COPYRIGHT and LICENSE files for more details.if @custom_field.is_for_all?render Primer::Beta::Blankslate.new(border: true) do |component|component.with_visual_icon(icon: :checklist)- component.with_heading(tag: :h2).with_content(I18n.t("projects.settings.project_custom_fields.is_required_blank_slate.heading"))- component.with_description { I18n.t("projects.settings.project_custom_fields.is_required_blank_slate.description") }+ component.with_heading(tag: :h2).with_content(I18n.t("custom_fields.admin.custom_field_projects.is_for_all_blank_slate.heading"))+ component.with_description { I18n.t("custom_fields.admin.custom_field_projects.is_for_all_blank_slate.description") }endelserender(Admin::CustomFields::CustomFieldProjects::TableComponent.new(diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 0f1dbeced65..b69c3b9919b 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -225,6 +225,12 @@ en:description: "Custom actions are one-click shortcuts to a set of pre-defined actions that you can make available on certain work packages based on status, role, type or project."custom_fields:+ admin:+ custom_field_projects:+ is_for_all_blank_slate:+ heading: For all projects+ description: This custom field is enabled in all projects since the "For all projects" option is checked. It cannot be deactivated for individual projects.+text_add_new_custom_field: >To add new custom fields to a project you first need to create them beforeyou can add them to this project.diff --git a/spec/features/admin/custom_fields/custom_fields_project_spec.rb b/spec/features/admin/custom_fields/custom_fields_project_spec.rbnew file mode 100644index 00000000000..0900a4dcf7b--- /dev/null+++ b/spec/features/admin/custom_fields/custom_fields_project_spec.rb@@ -0,0 +1,91 @@+#-- 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.+#++++require "spec_helper"++RSpec.describe "Custom Fields Multi-Project Activation", :js do+ shared_let(:admin) { create(:admin) }+ shared_let(:non_admin) { create(:user) }+ shared_let(:project) { create(:project) }+ shared_let(:archived_project) { create(:project, active: false) }+ shared_let(:custom_field) { create(:wp_custom_field) }+ shared_let(:custom_field_project) { create(:custom_fields_project, custom_field:, project:) }++ shared_let(:archived_project_custom_field) do+ create(:custom_fields_project, custom_field:, project: archived_project)+ end++ context "with insufficient permissions" do+ it "is not accessible" do+ login_as(non_admin)+ visit custom_field_projects_path(custom_field)++ expect(page).to have_text("You are not authorized to access this page.")+ end+ end++ context "with sufficient permissions" do+ before do+ login_as(admin)+ visit custom_field_projects_path(custom_field)+ end++ it "renders a list of projects linked to the custom field" do+ aggregate_failures "shows a correct breadcrumb menu" do+ within ".PageHeader-breadcrumbs" do+ expect(page).to have_link("Administration")+ expect(page).to have_link("Custom fields")+ expect(page).to have_link("Work packages")+ expect(page).to have_text(custom_field.name)+ end+ end++ aggregate_failures "shows tab navigation" do+ within_test_selector("custom_field_detail_header") do+ expect(page).to have_link("Details")+ expect(page).to have_link("Projects")+ end+ end++ aggregate_failures "shows the correct project mappings" do+ within "#project-table" do+ expect(page).to have_text(project.name)+ expect(page).to have_text(archived_project.name)+ end+ end+ end++ context "and the project custom field is required" do+ shared_let(:custom_field) { create(:user_custom_field, is_for_all: true) }++ it "renders a blank slate" do+ expect(page).to have_text("For all projects")+ end+ end+ end+end