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
clarify variable names
ulferts24a627db2273
diff --git a/app/components/projects/life_cycle_type_component.html.erb b/app/components/projects/life_cycle_type_component.html.erbindex 728082531b7..921c1cf191a 100644--- a/app/components/projects/life_cycle_type_component.html.erb+++ b/app/components/projects/life_cycle_type_component.html.erb@@ -1,8 +1,8 @@-<%= flex_layout(align_items: :center) do |element_container|- element_container.with_column(mr: 1, classes: icon_color_class) do+<%= flex_layout(align_items: :center) do |type_container|+ type_container.with_column(mr: 1, classes: icon_color_class) dorender Primer::Beta::Octicon.new(icon: icon)end- element_container.with_column do+ type_container.with_column dorender(Primer::Beta::Text.new(**text_options)) { text }endend %>diff --git a/app/components/projects/settings/life_cycles/index_component.html.erb b/app/components/projects/settings/life_cycles/index_component.html.erbindex 0bd1eebb941..60feef7d20e 100644--- a/app/components/projects/settings/life_cycles/index_component.html.erb+++ b/app/components/projects/settings/life_cycles/index_component.html.erb@@ -19,7 +19,7 @@font_weight: :bold,color: :subtle,'aria-label': t('projects.settings.actions.label_enable_all'),- data: { 'turbo-method': :post, 'turbo': true, test_selector: "enable-all-life-cycle-elements" }+ data: { 'turbo-method': :post, 'turbo': true, test_selector: "enable-all-life-cycle-steps" })) do |button|button.with_leading_visual_icon(icon: 'check-circle', color: :subtle)t('projects.settings.actions.label_enable_all')@@ -33,7 +33,7 @@font_weight: :bold,color: :subtle,'aria-label': t('projects.settings.actions.label_disable_all'),- data: { 'turbo-method': :post, 'turbo': true, test_selector: "disable-all-life-cycle-elements" }+ data: { 'turbo-method': :post, 'turbo': true, test_selector: "disable-all-life-cycle-steps" })) do |button|button.with_leading_visual_icon(icon: 'x-circle', color: :subtle)t('projects.settings.actions.label_disable_all')@@ -42,15 +42,15 @@endendend- if life_cycle_elements.empty?+ if life_cycle_definitions.empty?component.with_row dorender(Primer::Beta::Text.new(color: :subtle)) { t("projects.settings.life_cycle.non_defined") }endelse- life_cycle_elements.each do |element|+ life_cycle_definitions.each do |definition|component.with_row(data: { 'projects--settings--project-custom-fields-mapping-filter-target': 'searchItem' },- test_selector: "project-life-cycle-element-#{element.id}") do- render(Projects::Settings::LifeCycles::ElementComponent.new(project:, element:))+ test_selector: "project-life-cycle-step-#{definition.id}") do+ render(Projects::Settings::LifeCycles::StepComponent.new(project:, definition:))endendenddiff --git a/app/components/projects/settings/life_cycles/index_component.rb b/app/components/projects/settings/life_cycles/index_component.rbindex 55261db5c05..059b750e167 100644--- a/app/components/projects/settings/life_cycles/index_component.rb+++ b/app/components/projects/settings/life_cycles/index_component.rb@@ -35,13 +35,13 @@ module Projectsinclude OpTurbo::Streamableattr_reader :project,- :life_cycle_elements+ :life_cycle_definitions- def initialize(project:, life_cycle_elements:)+ def initialize(project:, life_cycle_definitions:)super@project = project- @life_cycle_elements = life_cycle_elements+ @life_cycle_definitions = life_cycle_definitionsendprivatediff --git a/app/components/projects/settings/life_cycles/element_component.html.erb b/app/components/projects/settings/life_cycles/step_component.html.erbsimilarity index 70%rename from app/components/projects/settings/life_cycles/element_component.html.erbrename to app/components/projects/settings/life_cycles/step_component.html.erbindex 7692b0d49df..0e11abc46da 100644--- a/app/components/projects/settings/life_cycles/element_component.html.erb+++ b/app/components/projects/settings/life_cycles/step_component.html.erb@@ -1,17 +1,17 @@<%=component_wrapper doflex_layout(align_items: :center,- justify_content: :space_between) do |element_container|- element_container.with_column(flex_layout: true) do |title_container|+ justify_content: :space_between) do |definition_container|+ definition_container.with_column(flex_layout: true) do |title_container|title_container.with_column(pt: 1, mr: 3) do- render(Primer::Beta::Text.new) { element.name }+ render(Primer::Beta::Text.new) { definition.name }endtitle_container.with_column(pt: 1) do- render(Projects::LifeCycleTypeComponent.new(element))+ render(Projects::LifeCycleTypeComponent.new(definition))endend# py: 1 quick fix: prevents the row from bouncing as the toggle switch currently changes height while toggling- element_container.with_column(py: 1, mr: 2) do+ definition_container.with_column(py: 1, mr: 2) do# buggy currently:# small variant + status_label_position: :start leads to a small bounce while toggling# 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@@ -19,12 +19,12 @@render(Primer::Alpha::ToggleSwitch.new(src: toggle_project_settings_life_cycle_path(project_life_cycle: {- definition_id: element.id,- type: element.type+ definition_id: definition.id,+ type: definition.type}),csrf_token: form_authenticity_token,- data: { test_selector: "toggle-project-life-cycle-#{element.id}" },+ data: { test_selector: "toggle-project-life-cycle-#{definition.id}" },aria: { label: toggle_aria_label },checked: active_in_project?,size: :small,diff --git a/app/components/projects/settings/life_cycles/element_component.rb b/app/components/projects/settings/life_cycles/step_component.rbsimilarity index 82%rename from app/components/projects/settings/life_cycles/element_component.rbrename to app/components/projects/settings/life_cycles/step_component.rbindex 07bea6ba3d1..2642d5ab55e 100644--- a/app/components/projects/settings/life_cycles/element_component.rb+++ b/app/components/projects/settings/life_cycles/step_component.rb@@ -29,36 +29,36 @@module Projectsmodule Settingsmodule LifeCycles- class ElementComponent < ApplicationComponent+ class StepComponent < ApplicationComponentinclude ApplicationHelperinclude OpPrimer::ComponentHelpersinclude OpTurbo::Streamable- attr_reader :element,+ attr_reader :definition,:project- def initialize(project:, element:)+ def initialize(project:, definition:)super- @element = element+ @definition = definition@project = projectenddef active_in_project?project.life_cycle_steps- .detect { |project_lc| project_lc.definition_id == element.id }+ .detect { |project_lc| project_lc.definition_id == definition.id }&.activeenddef toggle_aria_label- I18n.t("projects.settings.life_cycle.element.use_in_project", element: element.name)+ I18n.t("projects.settings.life_cycle.step.use_in_project", step: definition.name)endprivatedef wrapper_uniq_by- element.id+ definition.idendendenddiff --git a/app/controllers/projects/settings/life_cycles_controller.rb b/app/controllers/projects/settings/life_cycles_controller.rbindex 3c89293e659..6ad0c52f583 100644--- a/app/controllers/projects/settings/life_cycles_controller.rb+++ b/app/controllers/projects/settings/life_cycles_controller.rb@@ -31,21 +31,21 @@ class Projects::Settings::LifeCyclesController < Projects::SettingsControllerbefore_action :deny_access_on_feature_flag- before_action :load_life_cycle_elements, only: %i[show enable_all disable_all]+ before_action :load_life_cycle_definitions, only: %i[show enable_all disable_all]menu_item :settings_life_cyclesdef show; enddef toggle- element_params = params- .require(:project_life_cycle)- .permit(:definition_id, :type)- .to_h- .symbolize_keys- .merge(active: params["value"] == "1")-- upsert_one_step(**element_params)+ step_params = params+ .require(:project_life_cycle)+ .permit(:definition_id, :type)+ .to_h+ .symbolize_keys+ .merge(active: params["value"] == "1")++ upsert_one_step(**step_params)enddef disable_all@@ -62,8 +62,8 @@ class Projects::Settings::LifeCyclesController < Projects::SettingsControllerprivate- def load_life_cycle_elements- @life_cycle_elements = Project::LifeCycleStepDefinition.all+ def load_life_cycle_definitions+ @life_cycle_definitions = Project::LifeCycleStepDefinition.allenddef deny_access_on_feature_flag@@ -83,12 +83,12 @@ class Projects::Settings::LifeCyclesController < Projects::SettingsControllerdef upsert_all_steps(active: true)upsert_all(- @life_cycle_elements.map do |element|+ @life_cycle_definitions.map do |definition|{project_id: @project.id,- definition_id: element.id,+ definition_id: definition.id,active:,- type: project_type_for_definition_type(element.type)+ type: project_type_for_definition_type(definition.type)}end)@@ -108,7 +108,7 @@ class Projects::Settings::LifeCyclesController < Projects::SettingsControllerwhen Project::GateDefinition.nameProject::Gateelse- raise NotImplementedError, "Unknown life cycle element type"+ raise NotImplementedError, "Unknown life cycle definition type"endendenddiff --git a/app/views/projects/settings/life_cycles/show.html.erb b/app/views/projects/settings/life_cycles/show.html.erbindex b90027e4078..a53367c545b 100644--- a/app/views/projects/settings/life_cycles/show.html.erb+++ b/app/views/projects/settings/life_cycles/show.html.erb@@ -29,5 +29,5 @@ See COPYRIGHT and LICENSE files for more details.<div data-turbo="true"><%= render Projects::Settings::LifeCycles::ShowPageHeaderComponent.new(project: @project) %>- <%= render(Projects::Settings::LifeCycles::IndexComponent.new( project: @project, life_cycle_elements: @life_cycle_elements)) %>+ <%= render(Projects::Settings::LifeCycles::IndexComponent.new( project: @project, life_cycle_definitions: @life_cycle_definitions)) %></div>diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 9e6be75fcfd..0f5983e71bc 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -397,8 +397,8 @@ en:description: 'These project stages and gates in the project lifecycle will be displayed in your <a href=%{overview_url} target="_blank">project overview page</a> and are defined in the <a href=%{admin_settings_url} target="_blank">administration settings</a> by the administrator of the instance. You can enable or disable individual attributes.'non_defined: "Neither stages nor gates are currently defined."section_header: "Stages and gates"- element:- use_in_project: "Use %{element} in this project"+ step:+ use_in_project: "Use %{step} in this project"project_custom_fields:header:title: "Project attributes"diff --git a/spec/features/projects/life_cycle/active_in_project_spec.rb b/spec/features/projects/life_cycle/active_in_project_spec.rbindex d8e45c6df29..a098d75e520 100644--- a/spec/features/projects/life_cycle/active_in_project_spec.rb+++ b/spec/features/projects/life_cycle/active_in_project_spec.rb@@ -51,7 +51,7 @@ RSpec.describe "Projects life cycle settings", :js, :with_cuprite, with_flag: {context "with sufficient permissions" docurrent_user { user_with_permission }- it "allows toggling the active/inactive state of lifecycle elements" do+ it "allows toggling the active/inactive state of lifecycle steps" doproject_life_cycle_page.visit!project_life_cycle_page.expect_listed(initiating_stage => false,diff --git a/spec/support/pages/projects/settings/life_cycle.rb b/spec/support/pages/projects/settings/life_cycle.rbindex 4d076709caf..3f6572c123f 100644--- a/spec/support/pages/projects/settings/life_cycle.rb+++ b/spec/support/pages/projects/settings/life_cycle.rb@@ -44,47 +44,47 @@ module Pages"/projects/#{project.identifier}/settings/life_cycle"end- # Checks if the life cycle elements are listed in the order given and with the correct toggle state.- # @param life_cycle_elements [Hash{LifeCycleElement => Boolean}]- def expect_listed(**life_cycle_elements)- if life_cycle_elements.size > 1- life_cycle_elements.each_cons(2) do |(predecessor, _), (successor, _)|+ # Checks if the life cycle steps are listed in the order given and with the correct toggle state.+ # @param life_cycle_definitions [Hash{LifeCycleElement => Boolean}]+ def expect_listed(**life_cycle_definitions)+ if life_cycle_definitions.size > 1+ life_cycle_definitions.each_cons(2) do |(predecessor, _), (successor, _)|expect(page).to have_css("#{life_cycle_test_selector(predecessor)} + #{life_cycle_test_selector(successor)}")endend- life_cycle_elements.each do |element, active|- expect_toggle_state(element, active)+ life_cycle_definitions.each do |definition, active|+ expect_toggle_state(definition, active)endend- def expect_toggle_state(element, active)- within toggle_element(element) do+ def expect_toggle_state(definition, active)+ within toggle_step(definition) doexpect(page).to have_css(".ToggleSwitch-status#{expected_toggle_status(active)}"),- "Expected toggle for '#{element.name}' to be #{expected_toggle_status(active)} " \+ "Expected toggle for '#{definition.name}' to be #{expected_toggle_status(active)} " \"but was #{expected_toggle_status(!active)}"endend- def toggle(element)- toggle_element(element).click+ def toggle(definition)+ toggle_step(definition).clickenddef disable_all- find_test_selector("disable-all-life-cycle-elements").click+ find_test_selector("disable-all-life-cycle-steps").clickenddef enable_all- find_test_selector("enable-all-life-cycle-elements").click+ find_test_selector("enable-all-life-cycle-steps").clickend- def life_cycle_test_selector(element)- test_selector("project-life-cycle-element-#{element.id}")+ def life_cycle_test_selector(definition)+ test_selector("project-life-cycle-step-#{definition.id}")end- def toggle_element(element)- find_test_selector("toggle-project-life-cycle-#{element.id}")+ def toggle_step(definition)+ find_test_selector("toggle-project-life-cycle-#{definition.id}")enddef expected_toggle_status(active)