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

Update variable names

Dombi Attila479b9c892845
diff --git a/app/models/project/life_cycle_step.rb b/app/models/project/life_cycle_step.rb
index abccc560a70..c4e6cc58876 100644
--- a/app/models/project/life_cycle_step.rb
+++ b/app/models/project/life_cycle_step.rb
@@ -33,12 +33,14 @@ class Project::LifeCycleStep < ApplicationRecord
class_name: "Project::LifeCycleStepDefinition"
has_many :work_packages, inverse_of: :project_life_cycle_step, dependent: :nullify
- delegate :name, to: :life_cycle
+ delegate :name, to: :definition
attr_readonly :definition_id, :type
validates :type, inclusion: { in: %w[Project::Stage Project::Gate], message: :must_be_a_stage_or_gate }
+ scope :active, -> { where(active: true) }
+
def initialize(*args)
if instance_of? Project::LifeCycleStep
# Do not allow directly instantiating this class
diff --git a/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.html.erb b/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.html.erb
index ac45e374d7d..00e6527f89f 100644
--- a/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.html.erb
+++ b/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.html.erb
@@ -3,12 +3,12 @@
justify_content: :space_between,
classes: 'op-project-life-cycle-container',
data: {
- test_selector: "project-life-cycle-#{@project_life_cycle.id}"
- }) do |life_cycle_value_container|
+ test_selector: "project-life-cycle-#{@life_cycle_step.id}"
+ }) do |life_cycle_container|
# temporarily using inline styles in order to align the content as desired
life_cycle_container.with_row(mb: 1) do
render(Primer::Beta::Text.new(font_weight: :bold)) do
- concat @project_life_cycle.name
+ concat @life_cycle_step.name
end
end
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 9f54f071385..3687f4b162f 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
@@ -33,27 +33,27 @@ module ProjectLifeCycles
include ApplicationHelper
include OpPrimer::ComponentHelpers
- def initialize(project_life_cycle:)
+ def initialize(life_cycle_step:)
super
- @project_life_cycle = project_life_cycle
+ @life_cycle_step = life_cycle_step
end
private
def not_set?
- @project_life_cycle.not_set?
+ @life_cycle_step.not_set?
end
def render_value
- case @project_life_cycle
+ case @life_cycle_step
when Project::Gate
render(Primer::Beta::Text.new) do
- concat @project_life_cycle.date
+ concat @life_cycle_step.date
end
when Project::Stage
render(Primer::Beta::Text.new) do
- concat [@project_life_cycle.start_date, " - ", @project_life_cycle.end_date].join
+ concat [@life_cycle_step.start_date, " - ", @life_cycle_step.end_date].join
end
end
end
diff --git a/modules/overviews/app/components/project_life_cycles/sections/show_component.html.erb b/modules/overviews/app/components/project_life_cycles/sections/show_component.html.erb
index 4a0c5187d9c..611ddbba64d 100644
--- a/modules/overviews/app/components/project_life_cycles/sections/show_component.html.erb
+++ b/modules/overviews/app/components/project_life_cycles/sections/show_component.html.erb
@@ -6,13 +6,12 @@
)) do |section|
section.with_title { "Life Cycles" }
-
flex_layout do |details_container|
- @project_life_cycles.each_with_index do |project_life_cycle, i|
- margin = i == @project_life_cycles.size - 1 ? 0 : 3
+ @life_cycle_steps.each_with_index do |life_cycle_step, i|
+ margin = i == @life_cycle_steps.size - 1 ? 0 : 3
details_container.with_row(mb: margin) do
render(ProjectLifeCycles::Sections::ProjectLifeCycles::ShowComponent.new(
- project_life_cycle:
+ life_cycle_step:
))
end
end
diff --git a/modules/overviews/app/components/project_life_cycles/sections/show_component.rb b/modules/overviews/app/components/project_life_cycles/sections/show_component.rb
index a2788ed9a98..22335c8562c 100644
--- a/modules/overviews/app/components/project_life_cycles/sections/show_component.rb
+++ b/modules/overviews/app/components/project_life_cycles/sections/show_component.rb
@@ -37,7 +37,7 @@ module ProjectLifeCycles
super
@project = project
- @project_life_cycles = @project.project_life_cycles.includes(:life_cycle)
+ @life_cycle_steps = @project.life_cycle_steps.active.includes(:definition)
end
private