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

Apply phase renaming on the Overview page.

Dombi Attilac584415ad3ee
diff --git a/app/components/projects/life_cycle_component.rb b/app/components/projects/life_cycle_component.rb
index 4848048c168..31cc8acd650 100644
--- a/app/components/projects/life_cycle_component.rb
+++ b/app/components/projects/life_cycle_component.rb
@@ -52,7 +52,7 @@ module Projects
end
def icon_color_class
- helpers.hl_inline_class("life_cycle_step_definition", model)
+ helpers.hl_inline_class("project_phase_definition", model)
end
def text_options
diff --git a/app/contracts/project_life_cycle_steps/base_contract.rb b/app/contracts/project_life_cycle_steps/base_contract.rb
index 6d87f22db58..b04e89d011e 100644
--- a/app/contracts/project_life_cycle_steps/base_contract.rb
+++ b/app/contracts/project_life_cycle_steps/base_contract.rb
@@ -49,11 +49,9 @@ module ProjectLifeCycleSteps
# Compare consecutive steps in pairs
filtered_steps.each_cons(2) do |previous_step, current_step|
if has_invalid_dates?(previous_step, current_step)
- step = previous_step.is_a?(Project::Stage) ? "Stage" : "Gate"
- field = current_step.is_a?(Project::Stage) ? :date_range : :date
model.errors.import(
- current_step.errors.add(field, :non_continuous_dates, step:),
- attribute: :"available_phases.#{field}"
+ current_step.errors.add(:date_range, :non_continuous_dates),
+ attribute: :"available_phases.date_range"
)
end
end
@@ -66,20 +64,11 @@ module ProjectLifeCycleSteps
end
def end_date_for(step)
- case step
- when Project::Gate
- step.date
- when Project::Stage
- step.end_date || step.start_date # Use the start_date as fallback for single date stages
- end
+ step.end_date || step.start_date # Use the start_date as fallback for single date stages
end
def has_invalid_dates?(previous_step, current_step)
- if previous_step.instance_of?(current_step.class)
- start_date_for(current_step) <= end_date_for(previous_step)
- else
- start_date_for(current_step) < end_date_for(previous_step)
- end
+ start_date_for(current_step) <= end_date_for(previous_step)
end
end
end
diff --git a/app/forms/projects/life_cycles/form.rb b/app/forms/projects/life_cycles/form.rb
index f1b45dad326..50f291346db 100644
--- a/app/forms/projects/life_cycles/form.rb
+++ b/app/forms/projects/life_cycles/form.rb
@@ -28,22 +28,11 @@
module Projects::LifeCycles
class Form < ApplicationForm
form do |f|
- life_cycle_input(f)
+ multi_value_life_cycle_input(f)
end
private
- def life_cycle_input(form)
- case model
- when Project::Stage
- multi_value_life_cycle_input(form)
- when Project::Gate
- single_value_life_cycle_input(form)
- else
- raise NotImplementedError, "Unknown life cycle definition type #{model.class.name}"
- end
- end
-
def qa_field_name
"life-cycle-step-#{model.id}"
end
@@ -62,12 +51,6 @@ module Projects::LifeCycles
}
end
- def single_value_life_cycle_input(form)
- input_attributes = { name: :date, value: model.date }
-
- form.single_date_picker **base_input_attributes, **input_attributes
- end
-
def multi_value_life_cycle_input(form)
value = [model.start_date, model.end_date].compact.join(" - ")
@@ -85,20 +68,11 @@ module Projects::LifeCycles
end
def icon
- icon_name = case model
- when Project::Stage
- :"op-phase"
- when Project::Gate
- :diamond
- else
- raise NotImplementedError, "Unknown model #{model.class} to render a LifeCycleForm with"
- end
-
- render Primer::Beta::Octicon.new(icon: icon_name, classes: icon_color_class)
+ render Primer::Beta::Octicon.new(icon: :"op-phase", classes: icon_color_class)
end
def icon_color_class
- helpers.hl_inline_class("life_cycle_step_definition", model.definition)
+ helpers.hl_inline_class("project_phase_definition", model.definition)
end
end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index dbe833ca8c9..4ae83a0f3b1 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1037,6 +1037,7 @@ en:
project/phase:
date_range: "Date range"
definition: "Definition"
+ date_range: "Date range"
project/phase_definition:
name: "Name"
color: "Color"
diff --git a/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.rb b/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.rb
index 178b3b04e9e..e1820fc1404 100644
--- a/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.rb
+++ b/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.rb
@@ -52,18 +52,11 @@ module ProjectLifeCycles
end
def icon
- case model
- when Project::Stage
- :"op-phase"
- when Project::Gate
- :diamond
- else
- raise NotImplementedError, "Unknown model #{model.class} to render a LifeCycleForm with"
- end
+ :"op-phase"
end
def icon_color_class
- helpers.hl_inline_class("life_cycle_step_definition", model.definition)
+ helpers.hl_inline_class("project_phase_definition", model.definition)
end
def text