Skip to content

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

move lifecycle into life_cycle_steps namespace

ulferts39666a5ef461
diff --git a/app/components/projects/settings/life_cycles/index_component.html.erb b/app/components/projects/settings/life_cycle_steps/index_component.html.erb
similarity index 94%
rename from app/components/projects/settings/life_cycles/index_component.html.erb
rename to app/components/projects/settings/life_cycle_steps/index_component.html.erb
index da00e1047a3..8353dfb82ac 100644
--- a/app/components/projects/settings/life_cycles/index_component.html.erb
+++ b/app/components/projects/settings/life_cycle_steps/index_component.html.erb
@@ -34,7 +34,7 @@
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) do
render(Primer::Beta::Button.new(
tag: :a,
- href: enable_all_project_settings_life_cycle_path(project_id: project),
+ href: enable_all_project_settings_life_cycle_steps_path(project_id: project),
scheme: :invisible,
font_weight: :bold,
color: :subtle,
@@ -48,7 +48,7 @@
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) do
render(Primer::Beta::Button.new(
tag: :a,
- href: disable_all_project_settings_life_cycle_path(project_id: project),
+ href: disable_all_project_settings_life_cycle_steps_path(project_id: project),
scheme: :invisible,
font_weight: :bold,
color: :subtle,
@@ -70,7 +70,7 @@
life_cycle_definitions.each do |definition|
component.with_row(data: { 'projects--settings--border-box-filter-target': 'searchItem' },
test_selector: "project-life-cycle-step-#{definition.id}") do
- render(Projects::Settings::LifeCycles::StepComponent.new(project:, definition:))
+ render(Projects::Settings::LifeCycleSteps::StepComponent.new(project:, definition:))
end
end
end
diff --git a/app/components/projects/settings/life_cycles/index_component.rb b/app/components/projects/settings/life_cycle_steps/index_component.rb
similarity index 98%
rename from app/components/projects/settings/life_cycles/index_component.rb
rename to app/components/projects/settings/life_cycle_steps/index_component.rb
index 403c2615262..0e97dd685b8 100644
--- a/app/components/projects/settings/life_cycles/index_component.rb
+++ b/app/components/projects/settings/life_cycle_steps/index_component.rb
@@ -28,7 +28,7 @@
module Projects
module Settings
- module LifeCycles
+ module LifeCycleSteps
class IndexComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers
diff --git a/app/components/projects/settings/life_cycles/show_page_header_component.html.erb b/app/components/projects/settings/life_cycle_steps/show_page_header_component.html.erb
similarity index 100%
rename from app/components/projects/settings/life_cycles/show_page_header_component.html.erb
rename to app/components/projects/settings/life_cycle_steps/show_page_header_component.html.erb
diff --git a/app/components/projects/settings/life_cycles/show_page_header_component.rb b/app/components/projects/settings/life_cycle_steps/show_page_header_component.rb
similarity index 97%
rename from app/components/projects/settings/life_cycles/show_page_header_component.rb
rename to app/components/projects/settings/life_cycle_steps/show_page_header_component.rb
index 9641ab894d4..7aebeae941d 100644
--- a/app/components/projects/settings/life_cycles/show_page_header_component.rb
+++ b/app/components/projects/settings/life_cycle_steps/show_page_header_component.rb
@@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-module Projects::Settings::LifeCycles
+module Projects::Settings::LifeCycleSteps
class ShowPageHeaderComponent < ApplicationComponent
include ApplicationHelper
diff --git a/app/components/projects/settings/life_cycles/step_component.html.erb b/app/components/projects/settings/life_cycle_steps/step_component.html.erb
similarity index 94%
rename from app/components/projects/settings/life_cycles/step_component.html.erb
rename to app/components/projects/settings/life_cycle_steps/step_component.html.erb
index d8bf4ebdd55..e60d9f19aeb 100644
--- a/app/components/projects/settings/life_cycles/step_component.html.erb
+++ b/app/components/projects/settings/life_cycle_steps/step_component.html.erb
@@ -16,7 +16,7 @@
# behavior can be seen on primer's viewbook as well -> https://view-components-storybook.eastus.cloudapp.azure.com/view-components/lookbook/inspect/primer/alpha/toggle_switch/small
# quick fix: don't display loading indicator which is causing the bounce
render(Primer::Alpha::ToggleSwitch.new(
- src: toggle_project_settings_life_cycle_path(definition_id: definition.id),
+ src: toggle_project_settings_life_cycle_step_path(id: definition.id),
csrf_token: form_authenticity_token,
data: { test_selector: "toggle-project-life-cycle-#{definition.id}" },
aria: { label: toggle_aria_label },
diff --git a/app/components/projects/settings/life_cycles/step_component.rb b/app/components/projects/settings/life_cycle_steps/step_component.rb
similarity index 98%
rename from app/components/projects/settings/life_cycles/step_component.rb
rename to app/components/projects/settings/life_cycle_steps/step_component.rb
index 3f32e3d5c24..92de227324f 100644
--- a/app/components/projects/settings/life_cycles/step_component.rb
+++ b/app/components/projects/settings/life_cycle_steps/step_component.rb
@@ -28,7 +28,7 @@
module Projects
module Settings
- module LifeCycles
+ module LifeCycleSteps
class StepComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers
diff --git a/app/controllers/projects/settings/life_cycles_controller.rb b/app/controllers/projects/settings/life_cycle_steps_controller.rb
similarity index 88%
rename from app/controllers/projects/settings/life_cycles_controller.rb
rename to app/controllers/projects/settings/life_cycle_steps_controller.rb
index c8f85edd0e8..c28a3b12ab9 100644
--- a/app/controllers/projects/settings/life_cycles_controller.rb
+++ b/app/controllers/projects/settings/life_cycle_steps_controller.rb
@@ -26,19 +26,19 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-class Projects::Settings::LifeCyclesController < Projects::SettingsController
+class Projects::Settings::LifeCycleStepsController < Projects::SettingsController
include OpTurbo::ComponentStream
before_action :deny_access_on_feature_flag
- before_action :load_life_cycle_definitions, only: %i[show enable_all disable_all]
+ before_action :load_life_cycle_definitions, only: %i[index enable_all disable_all]
- menu_item :settings_life_cycles
+ menu_item :settings_life_cycle_steps
- def show; end
+ def index; end
def toggle
- definition = Project::LifeCycleStepDefinition.where(id: params[:definition_id])
+ definition = Project::LifeCycleStepDefinition.where(id: params[:id])
upsert_steps(definition, active: params["value"])
end
@@ -46,13 +46,13 @@ class Projects::Settings::LifeCyclesController < Projects::SettingsController
def disable_all
upsert_steps(@life_cycle_definitions, active: false)
- redirect_to action: :show
+ redirect_to action: :index
end
def enable_all
upsert_steps(@life_cycle_definitions, active: true)
- redirect_to action: :show
+ redirect_to action: :index
end
private
diff --git a/app/views/projects/settings/life_cycles/show.html.erb b/app/views/projects/settings/life_cycle_steps/index.html.erb
similarity index 79%
rename from app/views/projects/settings/life_cycles/show.html.erb
rename to app/views/projects/settings/life_cycle_steps/index.html.erb
index dcca60890c1..1fd3cc4337c 100644
--- a/app/views/projects/settings/life_cycles/show.html.erb
+++ b/app/views/projects/settings/life_cycle_steps/index.html.erb
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= render(Projects::Settings::LifeCycles::ShowPageHeaderComponent.new(project: @project)) %>
+<%= render(Projects::Settings::LifeCycleSteps::ShowPageHeaderComponent.new(project: @project)) %>
-<%= render(Projects::Settings::LifeCycles::IndexComponent.new(project: @project,
- life_cycle_definitions: @life_cycle_definitions)) %>
+<%= render(Projects::Settings::LifeCycleSteps::IndexComponent.new(project: @project,
+ life_cycle_definitions: @life_cycle_definitions)) %>
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index 6131ab47b6e..da3a44c8978 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -625,7 +625,11 @@ Redmine::MenuManager.map :project_menu do |menu|
project_menu_items = {
general: { caption: :label_information_plural },
- life_cycles: { caption: :label_life_cycle_plural, if: ->(*) { OpenProject::FeatureDecisions.stages_and_gates_active? } },
+ life_cycle_steps: {
+ caption: :label_life_cycle_step_plural,
+ action: :index,
+ if: ->(*) { OpenProject::FeatureDecisions.stages_and_gates_active? }
+ },
project_custom_fields: { caption: :label_project_attributes_plural },
modules: { caption: :label_module_plural },
types: { caption: :label_work_package_types },
@@ -639,9 +643,9 @@ Redmine::MenuManager.map :project_menu do |menu|
project_menu_items.each do |key, options|
menu.push :"settings_#{key}",
- { controller: "/projects/settings/#{key}", action: "show" },
+ { controller: "/projects/settings/#{key}", action: "show" }.merge(options.slice(:action)),
parent: :settings,
- **options
+ **options.except(:action)
end
end
diff --git a/config/initializers/permissions.rb b/config/initializers/permissions.rb
index 89baf66fdd9..d0ed1a2f597 100644
--- a/config/initializers/permissions.rb
+++ b/config/initializers/permissions.rb
@@ -135,7 +135,7 @@ Rails.application.reloader.to_prepare do
map.permission :select_project_life_cycle,
{
- "projects/settings/life_cycles": %i[show toggle enable_all disable_all]
+ "projects/settings/life_cycle_steps": %i[index toggle enable_all disable_all]
},
permissible_on: :project,
require: :member,
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a57949e0c33..e1be26ca815 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2592,7 +2592,7 @@ en:
label_none_parentheses: "(none)"
label_not_contains: "doesn't contain"
label_not_equals: "is not"
- label_life_cycle_plural: "Project lifecycle"
+ label_life_cycle_step_plural: "Project lifecycle"
label_on: "on"
label_operator_all: "is not empty"
label_operator_none: "is empty"
diff --git a/config/routes.rb b/config/routes.rb
index a038a5ded35..5dd529cc78d 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -244,7 +244,7 @@ Rails.application.routes.draw do
put :disable_all_of_section
end
end
- resource :life_cycle, only: %i[show] do
+ resources :life_cycle_steps, only: %i[index], path: "life_cycle" do
member do
post :toggle
end