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
Make the project admin life cycle settings page work.
Dombi Attila070833adca1c
diff --git a/app/components/projects/life_cycle_component.rb b/app/components/projects/life_cycle_component.rbindex d9fc12c025d..4848048c168 100644--- a/app/components/projects/life_cycle_component.rb+++ b/app/components/projects/life_cycle_component.rb@@ -31,6 +31,10 @@ module Projectsclass LifeCycleComponent < ApplicationComponentinclude OpPrimer::ComponentHelpers+ # TODO: This component is currently not in use! It should be a shared component+ # between the Projects::Settings::LifeCycleSteps::StepComponent and the+ # Settings::ProjectLifeCycleStepDefinitions::RowComponent.+ # It should hold the icon, definition name and gate text information.def textif model.start_gate? && model.end_gate?I18n.t("settings.project_phase_definitions.both_gate")diff --git a/app/components/projects/settings/life_cycle_steps/index_component.rb b/app/components/projects/settings/life_cycle_steps/index_component.rbindex bd1c174f1cc..d747a35cfc4 100644--- a/app/components/projects/settings/life_cycle_steps/index_component.rb+++ b/app/components/projects/settings/life_cycle_steps/index_component.rb@@ -40,7 +40,7 @@ module Projectsprivatedef life_cycle_definitions_and_step_active- active_ids = project.life_cycle_steps.where(active: true).pluck(:definition_id).to_set+ active_ids = project.phases.where(active: true).pluck(:definition_id).to_setlife_cycle_definitions.all.map do |definition|[definition, definition.id.in?(active_ids)]diff --git a/app/components/projects/settings/life_cycle_steps/index_page_header_component.html.erb b/app/components/projects/settings/life_cycle_steps/index_page_header_component.html.erbindex bce464dcb65..469b7bed2ac 100644--- a/app/components/projects/settings/life_cycle_steps/index_page_header_component.html.erb+++ b/app/components/projects/settings/life_cycle_steps/index_page_header_component.html.erb@@ -5,7 +5,7 @@t("projects.settings.life_cycle.header.description_html",overview_url: project_path(project),- admin_settings_url: admin_settings_project_life_cycle_step_definitions_path+ admin_settings_url: admin_settings_project_phase_definitions_path)endheader.with_breadcrumbs(breadcrumb_items)diff --git a/app/components/projects/settings/life_cycle_steps/step_component.html.erb b/app/components/projects/settings/life_cycle_steps/step_component.html.erbindex 492d1609532..7d777ea72c5 100644--- a/app/components/projects/settings/life_cycle_steps/step_component.html.erb+++ b/app/components/projects/settings/life_cycle_steps/step_component.html.erb@@ -4,11 +4,14 @@justify_content: :space_between) do |step_container|step_container.with_column(flex_layout: true, mr: 2, classes: "min-width-0") do |title_container|- title_container.with_column(pt: 1, mr: 3, classes: "ellipsis") do+ title_container.with_column(pt: 1, mr: 1, classes: icon_color_class) do+ render Primer::Beta::Octicon.new(icon: icon)+ end+ title_container.with_column(pt: 1, mr: 2, classes: "ellipsis") dorender(Primer::Beta::Text.new(classes: "filter-target-visible-text")) { definition.name }endtitle_container.with_column(pt: 1, classes: "no-wrap") do- render(Projects::LifeCycleComponent.new(definition))+ render(Primer::Beta::Text.new(**gate_text_options)) { gate_info }endend# py: 1 quick fix: prevents the row from bouncing as the toggle switch currently changes height while togglingdiff --git a/app/components/projects/settings/life_cycle_steps/step_component.rb b/app/components/projects/settings/life_cycle_steps/step_component.rbindex 2dd0f59b647..6691d1ef44e 100644--- a/app/components/projects/settings/life_cycle_steps/step_component.rb+++ b/app/components/projects/settings/life_cycle_steps/step_component.rb@@ -37,6 +37,32 @@ module Projectsoptions :definition,:active?+ # TODO: Remove these helper methods once the Projects::LifeCycleComponent+ # has been refactored.+ def icon+ :"op-phase"+ end++ def icon_color_class+ helpers.hl_inline_class("project_phase_definition", definition)+ end++ def gate_info+ if definition.start_gate? && model.end_gate?+ I18n.t("settings.project_phase_definitions.both_gate")+ elsif definition.start_gate?+ I18n.t("settings.project_phase_definitions.start_gate")+ elsif definition.end_gate?+ I18n.t("settings.project_phase_definitions.end_gate")+ else+ I18n.t("settings.project_phase_definitions.no_gate")+ end+ end++ def gate_text_options+ { color: :muted, font_size: :small }.merge(options)+ end+def toggle_aria_labelI18n.t("projects.settings.life_cycle.step.use_in_project", step: definition.name)enddiff --git a/app/components/settings/project_life_cycle_step_definitions/row_component.html.erb b/app/components/settings/project_life_cycle_step_definitions/row_component.html.erbindex 78361881817..9c40ff194f1 100644--- a/app/components/settings/project_life_cycle_step_definitions/row_component.html.erb+++ b/app/components/settings/project_life_cycle_step_definitions/row_component.html.erb@@ -39,6 +39,9 @@ See COPYRIGHT and LICENSE files for more details.)endend+ title_container.with_column(classes: icon_color_class) do+ render Primer::Beta::Octicon.new(icon: icon)+ endtitle_container.with_column(classes: "ellipsis", test_selector: "project-life-cycle-step-definition-name") dorender(if allowed_to_customize_life_cycle?@@ -57,7 +60,7 @@ See COPYRIGHT and LICENSE files for more details.endendtitle_container.with_column do- render(Projects::LifeCycleComponent.new(definition))+ render(Primer::Beta::Text.new(**gate_text_options)) { gate_info }endtitle_container.with_column(classes: "no-wrap") dorender(Primer::Beta::Text.new) { t("project.count", count: definition.project_count) }diff --git a/app/components/settings/project_life_cycle_step_definitions/row_component.rb b/app/components/settings/project_life_cycle_step_definitions/row_component.rbindex 777fcf1b76c..f7777cb91dc 100644--- a/app/components/settings/project_life_cycle_step_definitions/row_component.rb+++ b/app/components/settings/project_life_cycle_step_definitions/row_component.rb@@ -39,6 +39,32 @@ module Settingsoptions :first?,:last?+ # TODO: Remove these helper classes once the Projects::LifeCycleComponent+ # has been refactored.+ def icon+ :"op-phase"+ end++ def icon_color_class+ helpers.hl_inline_class("project_phase_definition", definition)+ end++ def gate_info+ if definition.start_gate? && definition.end_gate?+ I18n.t("settings.project_phase_definitions.both_gate")+ elsif definition.start_gate?+ I18n.t("settings.project_phase_definitions.start_gate")+ elsif definition.end_gate?+ I18n.t("settings.project_phase_definitions.end_gate")+ else+ I18n.t("settings.project_phase_definitions.no_gate")+ end+ end++ def gate_text_options+ { color: :muted, font_size: :small }.merge(options)+ end+privatedef move_action(menu:, move_to:, label:, icon:)diff --git a/app/controllers/projects/settings/life_cycle_steps_controller.rb b/app/controllers/projects/settings/life_cycle_steps_controller.rbindex 7041ac5f6dc..a45d938a19d 100644--- a/app/controllers/projects/settings/life_cycle_steps_controller.rb+++ b/app/controllers/projects/settings/life_cycle_steps_controller.rb@@ -71,8 +71,7 @@ class Projects::Settings::LifeCycleStepsController < Projects::SettingsControlle{project_id: @project.id,definition_id: definition.id,- active:,- type: definition.step_class+ active:}end,unique_by: %i[project_id definition_id]diff --git a/config/initializers/menus.rb b/config/initializers/menus.rbindex bc02214e87b..4faac61a3bd 100644--- a/config/initializers/menus.rb+++ b/config/initializers/menus.rb@@ -643,7 +643,7 @@ Redmine::MenuManager.map :project_menu do |menu|project_menu_items = {general: { caption: :label_information_plural },- life_cycles: {+ life_cycle_steps: {caption: :label_project_life_cycle,action: :index,if: ->(_) { OpenProject::FeatureDecisions.stages_and_gates_active? }