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
boilerplate for lifecycle settings
ulfertsd9ccb20ab4eb
diff --git a/app/controllers/projects/settings/life_cycles_controller.rb b/app/controllers/projects/settings/life_cycles_controller.rbnew file mode 100644index 00000000000..171520e29a8--- /dev/null+++ b/app/controllers/projects/settings/life_cycles_controller.rb@@ -0,0 +1,33 @@+# -- 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.+# ++++class Projects::Settings::LifeCyclesController < Projects::SettingsController+ include OpTurbo::ComponentStream++ def show; end+enddiff --git a/config/initializers/menus.rb b/config/initializers/menus.rbindex 33bdb9cd0d2..898635e9c43 100644--- a/config/initializers/menus.rb+++ b/config/initializers/menus.rb@@ -625,6 +625,7 @@ Redmine::MenuManager.map :project_menu do |menu|project_menu_items = {general: :label_information_plural,+ life_cycles: :label_life_cycle_plural,project_custom_fields: :label_project_attributes_plural,modules: :label_module_plural,types: :label_work_package_types,diff --git a/config/initializers/permissions.rb b/config/initializers/permissions.rbindex 87f571f46a9..2efe64416e0 100644--- a/config/initializers/permissions.rb+++ b/config/initializers/permissions.rb@@ -133,6 +133,13 @@ Rails.application.reloader.to_prepare dopermissible_on: :project,require: :member+ map.permission :select_project_life_cycle,+ {+ "projects/settings/life_cycles": %i[show]+ },+ permissible_on: :project,+ require: :member+map.permission :manage_members,{members: %i[index new create update destroy destroy_by_principal autocomplete_for_member menu],diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 9657cfe546b..f610a4a04c8 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -2579,6 +2579,7 @@ en:label_none_parentheses: "(none)"label_not_contains: "doesn't contain"label_not_equals: "is not"+ label_life_cycle_plural: "Project lifecycle"label_on: "on"label_operator_all: "is not empty"label_operator_none: "is empty"@@ -3203,6 +3204,8 @@ en:permission_search_project: "Search project"permission_select_custom_fields: "Select custom fields"permission_select_project_custom_fields: "Select project attributes"+ permission_select_project_life_cycle: "Select project stages and gates"+ permission_select_project_life_cycle_explanation: "Activate/Deactivate the stages and gates in a project."permission_select_project_modules: "Select project modules"permission_share_work_packages: "Share work packages"permission_manage_types: "Select types"diff --git a/config/routes.rb b/config/routes.rbindex 158ed8a6a29..36339b94060 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -244,6 +244,7 @@ Rails.application.routes.draw doput :disable_all_of_sectionendend+ resource :life_cycle, only: %i[show]resource :custom_fields, only: %i[show update]resource :repository, only: %i[show], controller: "repository"resource :versions, only: %i[show]diff --git a/spec/features/projects/life_cycle/active_in_project_spec.rb b/spec/features/projects/life_cycle/active_in_project_spec.rbnew file mode 100644index 00000000000..d055f3ffe36--- /dev/null+++ b/spec/features/projects/life_cycle/active_in_project_spec.rb@@ -0,0 +1,59 @@+# -- 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.+# ++++require "spec_helper"++RSpec.describe "Projects life cycle settings", :js, :with_cuprite do+ shared_let(:project) { create(:project) }++ shared_let(:user_with_permission) do+ create(:user,+ member_with_permissions: {+ # TODO: change to specific permission+ project: %w[+ select_project_life_cycle+ ]+ })+ end++ shared_let(:initiating_stage) { create(:stage, name: "Initiating") }+ shared_let(:read_to_execute_gate) { create(:gate, name: "Read to Execute") }+ shared_let(:executing_stage) { create(:stage, name: "Executing") }+ shared_let(:read_to_close_gate) { create(:gate, name: "Read to Close") }+ shared_let(:closing_stage) { create(:stage, name: "Closing") }++ let(:project_lifecycle_page) { Pages::Projects::Settings::LifeCycle.new(project) }++ context "with sufficient permissions" do+ current_user { user_with_permission }++ it "allows toggling the active/inactive state of lifecycle elements" do+ project_lifecycle_page.visit!+ end+ end+enddiff --git a/spec/support/pages/projects/settings/life_cycle.rb b/spec/support/pages/projects/settings/life_cycle.rbnew file mode 100644index 00000000000..0348a9c8c1f--- /dev/null+++ b/spec/support/pages/projects/settings/life_cycle.rb@@ -0,0 +1,50 @@+# -- 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.+# ++++require "support/pages/page"++module Pages+ module Projects+ # TODO: Ideally this would be turned into a module but it would require having the other settings pages being split up.+ class Settings+ class LifeCycle < Pages::Page+ attr_accessor :project++ def initialize(project)+ super()++ self.project = project+ end++ def path+ "/projects/#{project.identifier}/settings/life_cycle"+ end+ end+ end+ end+end