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
Initial project phase admin rename
Dombi Attilaa0e3c84e9d2e
diff --git a/app/components/projects/life_cycle_step_definitions/form_component.html.erb b/app/components/projects/life_cycle_step_definitions/form_component.html.erbnew file mode 100644index 00000000000..318b5a8f012--- /dev/null+++ b/app/components/projects/life_cycle_step_definitions/form_component.html.erb@@ -0,0 +1,91 @@+<%#-- copyright+OpenProject is an open source project management software.+Copyright (C) the OpenProject GmbH++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License version 3.++OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+Copyright (C) 2006-2013 Jean-Philippe Lang+Copyright (C) 2010-2013 the ChiliProject Team++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License+as published by the Free Software Foundation; either version 2+of the License, or (at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; if not, write to the Free Software+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.++See COPYRIGHT and LICENSE files for more details.++++#%>++<%= admin_settings_primer_form_with(+ model: [:admin, :settings, model],+ data: { controller: "show-when-checked" }+ ) do |f|+ flex_layout do |body|+ body.with_row do+ render Primer::Alpha::TabPanels.new(label: "label") do |tab_panel|+ tab_panel.with_tab(selected: selected?(:details), id: "tab-phases--details") do |tab|+ tab.with_text { I18n.t("label_details") }+ tab.with_panel do+ render Projects::LifeCycleStepDefinitions::DetailsForm.new(f)+ end+ end+ tab_panel.with_tab(selected: selected?(:phase_gates), id: "tab-phases--phase-gates") do |tab|+ tab.with_text { I18n.t("settings.project_phase_definitions.phase_gates") }+ tab.with_panel do+ flex_layout do |gates_tab|+ gates_tab.with_row(mt: 2) do+ render Projects::LifeCycleStepDefinitions::StartGateCheckboxForm.new(f)+ end+ gates_tab.with_row(+ mt: 2,+ classes: model.start_gate.blank? ? "d-none" : "",+ data: {+ target_name: "start_gate",+ "show-when-checked-target": "effect",+ visibility_class: "d-none"+ }+ ) do+ render Projects::LifeCycleStepDefinitions::StartGateNameForm.new(f)+ end+ gates_tab.with_row(mt: 2) do+ render Projects::LifeCycleStepDefinitions::FinishGateCheckboxForm.new(f)+ end+ gates_tab.with_row(+ mt: 2,+ classes: model.end_gate.blank? ? "d-none" : "",+ data: {+ target_name: "end_gate",+ "show-when-checked-target": "effect",+ visibility_class: "d-none"+ }+ ) do+ render Projects::LifeCycleStepDefinitions::FinishGateNameForm.new(f)+ end+ end+ end+ end+ end+ end++ body.with_row(mt: 4) do+ render_inline_form(f) do |submit_form|+ submit_form.submit(+ scheme: :primary,+ name: :submit,+ label: I18n.t(model.persisted? ? :button_update : :button_create)+ )+ end+ end+ end+ end %>diff --git a/app/components/projects/life_cycle_step_definitions/form_component.rb b/app/components/projects/life_cycle_step_definitions/form_component.rbnew file mode 100644index 00000000000..842bea0270f--- /dev/null+++ b/app/components/projects/life_cycle_step_definitions/form_component.rb@@ -0,0 +1,52 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2010-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# +++module Projects::LifeCycleStepDefinitions+ class FormComponent < ApplicationComponent+ include OpPrimer::ComponentHelpers++ def selected?(tabname)+ tabname == if no_errors || details_tab_errors.any?+ :details+ else+ :phase_gates+ end+ end++ private++ def no_errors+ model.errors.empty?+ end++ def details_tab_errors+ model.errors.attribute_names & %i[name color]+ end+ end+enddiff --git a/app/components/projects/life_cycle_type_component.rb b/app/components/projects/life_cycle_type_component.rbindex 453f5d90c5d..fa266144999 100644--- a/app/components/projects/life_cycle_type_component.rb+++ b/app/components/projects/life_cycle_type_component.rb@@ -32,18 +32,19 @@ module Projectsinclude OpPrimer::ComponentHelpersdef text- model.model_name.human+ if model.start_gate? && model.end_gate?+ I18n.t("settings.project_phase_definitions.both_gate")+ elsif model.start_gate?+ I18n.t("settings.project_phase_definitions.start_gate")+ elsif model.end_gate?+ I18n.t("settings.project_phase_definitions.end_gate")+ else+ I18n.t("settings.project_phase_definitions.no_gate")+ endenddef icon- case model- when Project::StageDefinition- :"git-commit"- when Project::GateDefinition- :diamond- else- raise NotImplementedError, "Unknown model #{model.class} to render a LifeCycleTypeComponent with"- end+ :"git-commit"enddef icon_color_classdiff --git a/app/components/settings/project_life_cycle_step_definitions/form_header_component.html.erb b/app/components/settings/project_life_cycle_step_definitions/form_header_component.html.erbindex 5760eb16da6..13a2b1f52a1 100644--- a/app/components/settings/project_life_cycle_step_definitions/form_header_component.html.erb+++ b/app/components/settings/project_life_cycle_step_definitions/form_header_component.html.erb@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><%= render Primer::OpenProject::PageHeader.new do |header|- header.with_title { t("settings.project_life_cycle_step_definitions.#{heading_scope}.heading") }- header.with_description { t("settings.project_life_cycle_step_definitions.new.description") }+ header.with_title { t("settings.project_phase_definitions.#{heading_scope}.heading") }+ header.with_description { t("settings.project_phase_definitions.new.description") }header.with_breadcrumbs(breadcrumbs_items)end %>diff --git a/app/components/settings/project_life_cycle_step_definitions/form_header_component.rb b/app/components/settings/project_life_cycle_step_definitions/form_header_component.rbindex 8fa4442ce8d..a1f8a770b1b 100644--- a/app/components/settings/project_life_cycle_step_definitions/form_header_component.rb+++ b/app/components/settings/project_life_cycle_step_definitions/form_header_component.rb@@ -44,10 +44,10 @@ module Settingstext: t("label_project_plural")},{- href: admin_settings_project_life_cycle_step_definitions_path,- text: t("settings.project_life_cycle_step_definitions.heading")+ href: admin_settings_project_phase_definitions_path,+ text: t("settings.project_phase_definitions.heading")},- t("settings.project_life_cycle_step_definitions.#{heading_scope}.heading")+ t("settings.project_phase_definitions.#{heading_scope}.heading")]endenddiff --git a/app/components/settings/project_life_cycle_step_definitions/index_component.html.erb b/app/components/settings/project_life_cycle_step_definitions/index_component.html.erbindex 316c0311822..fa62df66340 100644--- a/app/components/settings/project_life_cycle_step_definitions/index_component.html.erb+++ b/app/components/settings/project_life_cycle_step_definitions/index_component.html.erb@@ -35,9 +35,9 @@ See COPYRIGHT and LICENSE files for more details.render(Primer::OpenProject::SubHeader.new) do |subheader|subheader.with_filter_input(name: "border-box-filter",- label: t("settings.project_life_cycle_step_definitions.filter.label"),+ label: t("settings.project_phase_definitions.filter.label"),visually_hide_label: true,- placeholder: t("settings.project_life_cycle_step_definitions.filter.label"),+ placeholder: t("settings.project_phase_definitions.filter.label"),leading_visual: {icon: :search,size: :small@@ -50,32 +50,15 @@ See COPYRIGHT and LICENSE files for more details.)subheader.with_action_component dorender(- Primer::Alpha::ActionMenu.new(- anchor_align: :end- )- ) do |menu|- menu.with_show_button(+ Primer::Beta::Button.new(scheme: :primary,- aria: { label: I18n.t("settings.project_life_cycle_step_definitions.label_add_description") }- ) do |button|- button.with_leading_visual_icon(icon: :plus)- button.with_trailing_action_icon(icon: :"triangle-down")- I18n.t("settings.project_life_cycle_step_definitions.label_add")- end-- menu.with_item(- label: I18n.t("settings.project_life_cycle_step_definitions.label_add_stage"),- href: new_stage_admin_settings_project_life_cycle_step_definitions_path- ) do |item|- item.with_leading_visual_icon(icon: "git-commit")- end-- menu.with_item(- label: I18n.t("settings.project_life_cycle_step_definitions.label_add_gate"),- href: new_gate_admin_settings_project_life_cycle_step_definitions_path- ) do |item|- item.with_leading_visual_icon(icon: "diamond")- end+ aria: { label: I18n.t("settings.project_phase_definitions.label_add_description") },+ tag: :a,+ href: new_admin_settings_project_phase_definition_path+ )+ ) do |button|+ button.with_leading_visual_icon(icon: :plus)+ I18n.t("settings.project_phase_definitions.label_add")endendend@@ -90,7 +73,7 @@ See COPYRIGHT and LICENSE files for more details.flex_layout(justify_content: :space_between, align_items: :center) do |header_container|header_container.with_column dorender(Primer::Beta::Text.new(font_weight: :bold)) do- I18n.t("settings.project_life_cycle_step_definitions.section_header")+ I18n.t("settings.project_phase_definitions.section_header")endendend@@ -98,7 +81,7 @@ See COPYRIGHT and LICENSE files for more details.if definitions.empty?component.with_row dorender(Primer::Beta::Text.new(color: :subtle)) do- t("settings.project_life_cycle_step_definitions.non_defined")+ t("settings.project_phase_definitions.non_defined")endendelsediff --git a/app/components/settings/project_life_cycle_step_definitions/index_component.rb b/app/components/settings/project_life_cycle_step_definitions/index_component.rbindex f2e6d2b064b..f8a318c62de 100644--- a/app/components/settings/project_life_cycle_step_definitions/index_component.rb+++ b/app/components/settings/project_life_cycle_step_definitions/index_component.rb@@ -57,7 +57,7 @@ module Settingsdef draggable_item_config(definition){"draggable-type": "life-cycle-step-definition",- "drop-url": drop_admin_settings_project_life_cycle_step_definition_path(definition)+ "drop-url": drop_admin_settings_project_phase_definition_path(definition)}endenddiff --git a/app/components/settings/project_life_cycle_step_definitions/index_header_component.html.erb b/app/components/settings/project_life_cycle_step_definitions/index_header_component.html.erbindex 5d9996081ec..f2abfc4f591 100644--- a/app/components/settings/project_life_cycle_step_definitions/index_header_component.html.erb+++ b/app/components/settings/project_life_cycle_step_definitions/index_header_component.html.erb@@ -29,8 +29,8 @@ See COPYRIGHT and LICENSE files for more details.<%=render Primer::OpenProject::PageHeader.new do |header|- header.with_title { t("settings.project_life_cycle_step_definitions.heading") }- header.with_description { t("settings.project_life_cycle_step_definitions.heading_description") }+ header.with_title { t("settings.project_phase_definitions.heading") }+ header.with_description { t("settings.project_phase_definitions.heading_description") }header.with_breadcrumbs(breadcrumbs_items)end%>diff --git a/app/components/settings/project_life_cycle_step_definitions/index_header_component.rb b/app/components/settings/project_life_cycle_step_definitions/index_header_component.rbindex df21b4805b9..b182ea3219d 100644--- a/app/components/settings/project_life_cycle_step_definitions/index_header_component.rb+++ b/app/components/settings/project_life_cycle_step_definitions/index_header_component.rb@@ -35,7 +35,7 @@ module Settings[{ href: admin_index_path, text: t("label_administration") },{ href: admin_settings_project_custom_fields_path, text: t("label_project_plural") },- t("settings.project_life_cycle_step_definitions.heading")+ t("settings.project_phase_definitions.heading")]endenddiff --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 5a0698e192a..06219228bd4 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@@ -44,7 +44,7 @@ See COPYRIGHT and LICENSE files for more details.if allowed_to_customize_life_cycle?Primer::Beta::Link.new(classes: "filter-target-visible-text",- href: edit_admin_settings_project_life_cycle_step_definition_path(definition),+ href: edit_admin_settings_project_phase_definition_path(definition),font_weight: :bold)else@@ -71,7 +71,7 @@ See COPYRIGHT and LICENSE files for more details.menu.with_item(label: t(:label_edit),- href: edit_admin_settings_project_life_cycle_step_definition_path(definition)+ href: edit_admin_settings_project_phase_definition_path(definition)) do |item|item.with_leading_visual_icon(icon: :pencil)end@@ -88,7 +88,7 @@ See COPYRIGHT and LICENSE files for more details.menu.with_item(label: t(:text_destroy),scheme: :danger,- href: admin_settings_project_life_cycle_step_definition_path(definition),+ href: admin_settings_project_phase_definition_path(definition),form_arguments: {method: :delete,data: {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 1e6de58ad6a..777fcf1b76c 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@@ -44,7 +44,7 @@ module Settingsdef move_action(menu:, move_to:, label:, icon:)menu.with_item(label:,- href: move_admin_settings_project_life_cycle_step_definition_path(definition, move_to:),+ href: move_admin_settings_project_phase_definition_path(definition, move_to:),form_arguments: {method: :patch},diff --git a/app/controllers/admin/settings/project_life_cycle_step_definitions_controller.rb b/app/controllers/admin/settings/project_life_cycle_definitions_controller.rbsimilarity index 88%rename from app/controllers/admin/settings/project_life_cycle_step_definitions_controller.rbrename to app/controllers/admin/settings/project_life_cycle_definitions_controller.rbindex 51cb25f5b4c..dc7d5a26396 100644--- a/app/controllers/admin/settings/project_life_cycle_step_definitions_controller.rb+++ b/app/controllers/admin/settings/project_life_cycle_definitions_controller.rb@@ -29,29 +29,24 @@#++module Admin::Settings- class ProjectLifeCycleStepDefinitionsController < ::Admin::SettingsController+ class ProjectLifeCycleDefinitionsController < ::Admin::SettingsControllerinclude FlashMessagesOutputSafetyHelperinclude OpTurbo::ComponentStreaminclude Projects::LifeCycleDefinitionHelper- menu_item :project_life_cycle_step_definitions_settings+ menu_item :project_life_cycle_definitions_settingsbefore_action :check_feature_flagbefore_action :require_enterprise_token, except: %i[index]- before_action :find_definitions, only: %i[index]before_action :find_definition, only: %i[edit update destroy move drop]- def index; end-- def new_stage- @definition = Project::StageDefinition.new-- render :form+ def index+ @definitions = Project::PhaseDefinition.with_project_countend- def new_gate- @definition = Project::GateDefinition.new+ def new+ @definition = Project::PhaseDefinition.newrender :formend@@ -122,16 +117,21 @@ module Admin::Settingsrender_402 unless allowed_to_customize_life_cycle?end- def find_definitions- @definitions = Project::PhaseDefinition.with_project_count- end-def find_definition@definition = Project::PhaseDefinition.find(params[:id])enddef definition_params- params.require(:project_life_cycle_step_definition).permit(:type, :name, :color_id)+ params.require(:project_phase_definition)+ .permit(+ :type,+ :name,+ :color_id,+ :start_gate_name,+ :end_gate_name,+ :start_gate,+ :end_gate+ )enddef update_definitions_via_turbo_streamdiff --git a/app/forms/projects/life_cycle_step_definitions/form.rb b/app/forms/projects/life_cycle_step_definitions/details_form.rbsimilarity index 85%rename from app/forms/projects/life_cycle_step_definitions/form.rbrename to app/forms/projects/life_cycle_step_definitions/details_form.rbindex 8ed13372050..45df97cd5cb 100644--- a/app/forms/projects/life_cycle_step_definitions/form.rb+++ b/app/forms/projects/life_cycle_step_definitions/details_form.rb@@ -29,33 +29,20 @@#++module Projects::LifeCycleStepDefinitions- class Form < ApplicationForm+ class DetailsForm < ApplicationFormform do |f|- f.hidden(name: :type) unless model.persisted?-f.text_field(label: attribute_name(:name),name: :name,required: true,input_width: :medium)-f.color_select_list(label: attribute_name(:color),name: :color,required: true,input_width: :medium)-- f.submit(- scheme: :primary,- name: :submit,- label: submit_label- )- end-- def submit_label- I18n.t(model.persisted? ? :button_update : :button_create)endendenddiff --git a/app/forms/projects/life_cycle_step_definitions/finish_gate_checkbox_form.rb b/app/forms/projects/life_cycle_step_definitions/finish_gate_checkbox_form.rbnew file mode 100644index 00000000000..0a4d4f043ef--- /dev/null+++ b/app/forms/projects/life_cycle_step_definitions/finish_gate_checkbox_form.rb@@ -0,0 +1,46 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Projects::LifeCycleStepDefinitions+ class FinishGateCheckboxForm < ApplicationForm+ form do |f|+ f.check_box(+ label: attribute_name(:end_gate),+ name: :end_gate,+ caption: I18n.t("settings.project_phase_definitions.end_gate_caption"),+ input_width: :medium,+ data: {+ "show-when-checked-target": "cause",+ target_name: "end_gate"+ }+ )+ end+ end+enddiff --git a/app/forms/projects/life_cycle_step_definitions/finish_gate_name_form.rb b/app/forms/projects/life_cycle_step_definitions/finish_gate_name_form.rbnew file mode 100644index 00000000000..6dc4192ff39--- /dev/null+++ b/app/forms/projects/life_cycle_step_definitions/finish_gate_name_form.rb@@ -0,0 +1,42 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Projects::LifeCycleStepDefinitions+ class FinishGateNameForm < ApplicationForm+ form do |f|+ f.text_field(+ label: attribute_name(:end_gate_name),+ name: :end_gate_name,+ input_width: :medium,+ required: true+ )+ end+ end+enddiff --git a/app/forms/projects/life_cycle_step_definitions/start_gate_checkbox_form.rb b/app/forms/projects/life_cycle_step_definitions/start_gate_checkbox_form.rbnew file mode 100644index 00000000000..32873532370--- /dev/null+++ b/app/forms/projects/life_cycle_step_definitions/start_gate_checkbox_form.rb@@ -0,0 +1,46 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Projects::LifeCycleStepDefinitions+ class StartGateCheckboxForm < ApplicationForm+ form do |f|+ f.check_box(+ label: attribute_name(:start_gate),+ name: :start_gate,+ caption: I18n.t("settings.project_phase_definitions.start_gate_caption"),+ input_width: :medium,+ data: {+ "show-when-checked-target": "cause",+ target_name: "start_gate"+ }+ )+ end+ end+enddiff --git a/app/forms/projects/life_cycle_step_definitions/start_gate_name_form.rb b/app/forms/projects/life_cycle_step_definitions/start_gate_name_form.rbnew file mode 100644index 00000000000..95985d77ce0--- /dev/null+++ b/app/forms/projects/life_cycle_step_definitions/start_gate_name_form.rb@@ -0,0 +1,42 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Projects::LifeCycleStepDefinitions+ class StartGateNameForm < ApplicationForm+ form do |f|+ f.text_field(+ label: attribute_name(:start_gate_name),+ name: :start_gate_name,+ input_width: :medium,+ required: true+ )+ end+ end+enddiff --git a/app/models/project/phase_definition.rb b/app/models/project/phase_definition.rbindex 2ce0a661959..3acd31b9808 100644--- a/app/models/project/phase_definition.rb+++ b/app/models/project/phase_definition.rb@@ -40,7 +40,8 @@ class Project::PhaseDefinition < ApplicationRecordbelongs_to :color, optional: falsevalidates :name, presence: true, uniqueness: true-+ validates :start_gate_name, presence: true, if: Proc.new { |d| d.start_gate.present? }+ validates :end_gate_name, presence: true, if: Proc.new { |d| d.end_gate.present? }acts_as_listdefault_scope { order(:position) }diff --git a/app/views/admin/settings/project_life_cycle_step_definitions/form.html.erb b/app/views/admin/settings/project_life_cycle_definitions/form.html.erbsimilarity index 72%rename from app/views/admin/settings/project_life_cycle_step_definitions/form.html.erbrename to app/views/admin/settings/project_life_cycle_definitions/form.html.erbindex 0e49b6a395d..ceab5ffd9f8 100644--- a/app/views/admin/settings/project_life_cycle_step_definitions/form.html.erb+++ b/app/views/admin/settings/project_life_cycle_definitions/form.html.erb@@ -27,18 +27,12 @@ See COPYRIGHT and LICENSE files for more details.++#%>-<% heading_scope = "#{@definition.persisted? ? :edit : :new}_#{@definition.is_a?(Project::StageDefinition) ? :stage : :gate}" %>+<% heading_scope = @definition.persisted? ? :edit : :new %><% html_title t(:label_administration),- t("settings.project_life_cycle_step_definitions.heading"),- t("settings.project_life_cycle_step_definitions.#{heading_scope}.heading") %>+ t("settings.project_phase_definitions.heading"),+ t("settings.project_phase_definitions.#{heading_scope}.heading") %><%= render Settings::ProjectLifeCycleStepDefinitions::FormHeaderComponent.new(@definition, heading_scope:) %>-<%=- admin_settings_primer_form_with(- model: [:admin, :settings, @definition.becomes(Project::PhaseDefinition)]- ) do |f|- render Projects::LifeCycleStepDefinitions::Form.new(f)- end-%>+<%= render Projects::LifeCycleStepDefinitions::FormComponent.new(@definition) %>diff --git a/app/views/admin/settings/project_life_cycle_step_definitions/index.html.erb b/app/views/admin/settings/project_life_cycle_definitions/index.html.erbsimilarity index 93%rename from app/views/admin/settings/project_life_cycle_step_definitions/index.html.erbrename to app/views/admin/settings/project_life_cycle_definitions/index.html.erbindex cf8877a719e..f38e3e49a81 100644--- a/app/views/admin/settings/project_life_cycle_step_definitions/index.html.erb+++ b/app/views/admin/settings/project_life_cycle_definitions/index.html.erb@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.++#%>-<% html_title t(:label_administration), t("settings.project_life_cycle_step_definitions.heading") %>+<% html_title t(:label_administration), t("settings.project_phase_definitions.heading") %><%= render Settings::ProjectLifeCycleStepDefinitions::IndexHeaderComponent.new %><%= render Settings::ProjectLifeCycleStepDefinitions::IndexComponent.new(definitions: @definitions) %>diff --git a/config/initializers/menus.rb b/config/initializers/menus.rbindex cfa5291483f..bc02214e87b 100644--- a/config/initializers/menus.rb+++ b/config/initializers/menus.rb@@ -349,7 +349,7 @@ Redmine::MenuManager.map :admin_menu do |menu|menu.push :admin_projects_settings,->(_) { # TODO: doesn't need to be a proc when condition is removedif OpenProject::FeatureDecisions.stages_and_gates_active?- { controller: "/admin/settings/project_life_cycle_step_definitions", action: :index }+ { controller: "/admin/settings/project_life_cycle_definitions", action: :index }else{ controller: "/admin/settings/project_custom_fields", action: :index }end@@ -358,10 +358,10 @@ Redmine::MenuManager.map :admin_menu do |menu|caption: :label_project_plural,icon: "project"- menu.push :project_life_cycle_step_definitions_settings,- { controller: "/admin/settings/project_life_cycle_step_definitions", action: :index },+ menu.push :project_life_cycle_definitions_settings,+ { controller: "/admin/settings/project_life_cycle_definitions", action: :index },if: ->(_) { User.current.admin? && OpenProject::FeatureDecisions.stages_and_gates_active? },- caption: :label_project_lifecycle,+ caption: :label_project_life_cycle,parent: :admin_projects_settingsmenu.push :project_custom_fields_settings,@@ -643,8 +643,8 @@ Redmine::MenuManager.map :project_menu do |menu|project_menu_items = {general: { caption: :label_information_plural },- life_cycle_steps: {- caption: :label_life_cycle_step_plural,+ life_cycles: {+ caption: :label_project_life_cycle,action: :index,if: ->(_) { OpenProject::FeatureDecisions.stages_and_gates_active? }},diff --git a/config/locales/en.yml b/config/locales/en.ymlindex bd75137d905..0332c1d1e78 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1039,6 +1039,10 @@ en:project/phase_definition:name: "Name"color: "Color"+ start_gate: "Start phase gate"+ start_gate_name: "Start phase gate name"+ end_gate: "Finish phase gate"+ end_gate_name: "Finish phase gate name"query:sums: "Sums"columns: "Columns"@@ -2870,7 +2874,7 @@ en:label_project_new: "New project"label_project_plural: "Projects"label_project_list_plural: "Project lists"- label_project_lifecycle: "Project lifecycle"+ label_project_life_cycle: "Project life cycle"label_project_attributes_plural: "Project attributes"label_project_custom_field_plural: "Project attributes"label_project_settings: "Project settings"@@ -3957,27 +3961,27 @@ en:new:heading: "New attribute"description: "Changes to this project attribute will be reflected in all projects where it is enabled. Required attributes cannot be disabled on a per-project basis."- project_life_cycle_step_definitions:- heading: "Project lifecycle"- heading_description: "The project lifecycle consists of stages and gates that structure your projects. They will appear in the overview page of a project and be available in the projects list. Individual stages and gates can be selected to customize a project but reordering is not possible on a project level."+ project_phase_definitions:+ heading: "Project life cycle"+ heading_description: "The project life cycles consists of stages and gates that structure your projects. They will appear in the overview page of a project and be available in the projects list. Individual stages and gates can be selected to customize a project but reordering is not possible on a project level."label_add: "Add"label_add_description: "Add lifecycle definition"- label_add_stage: "Stage"- label_add_gate: "Gate"filter:label: "Search project stage or gate"- section_header: "Stages and gates"+ section_header: "Phases"non_defined: "Neither stages nor gates are currently defined."+ phase_gates: "Phase gates"new:description: "Changes to this project step will be reflected in all projects where it is enabled."- new_stage:- heading: "New stage"- new_gate:- heading: "New gate"- edit_stage:- heading: "Edit stage"- edit_gate:- heading: "Edit gate"+ heading: "New Phase"+ edit:+ heading: "Edit Phase"+ both_gate: "Start and finish gate"+ no_gate: "No gate"+ start_gate: "Start gate"+ start_gate_caption: "Add a gate with the start date of the phase"+ end_gate: "Finish gate"+ end_gate_caption: "Add a gate with the end date of the phase"projects:missing_dependencies: "Project module %{module} was checked which depends on %{dependencies}. You need to check these dependencies as well."section_new_projects: "Settings for new projects"diff --git a/config/routes.rb b/config/routes.rbindex 9d448e89d0c..4983aef110b 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -551,14 +551,9 @@ Rails.application.routes.draw doresource :progress_tracking, controller: "/admin/settings/progress_tracking", only: %i[show update]resource :projects, controller: "/admin/settings/projects_settings", only: %i[show update]resource :new_project, controller: "/admin/settings/new_project_settings", only: %i[show update]- resources :project_life_cycle_step_definitions,+ resources :project_phase_definitions,path: "project_life_cycle",- controller: "/admin/settings/project_life_cycle_step_definitions",- only: %i[index create edit update destroy] do- collection do- get :new_stage- get :new_gate- end+ controller: "/admin/settings/project_life_cycle_definitions" domember dopatch :moveput :drop # should be patch, but requires passing method to generic-drag-and-drop controllerdiff --git a/frontend/src/stimulus/controllers/show-when-checked.controller.ts b/frontend/src/stimulus/controllers/show-when-checked.controller.tsindex 4646bbd20ea..3793039d8c8 100644--- a/frontend/src/stimulus/controllers/show-when-checked.controller.ts+++ b/frontend/src/stimulus/controllers/show-when-checked.controller.ts@@ -24,9 +24,22 @@ export default class OpShowWhenCheckedController extends ApplicationController {}private toggleDisabled(evt:InputEvent):void {- const checked = (evt.target as HTMLInputElement).checked;- this.effectTargets.forEach((el) => {- el.hidden = (this.hasReversedValue && this.reversedValue) ? checked : !checked;- });+ const input = evt.target as HTMLInputElement;+ const targetName = input.dataset.targetName;+ const checked = input.checked;+ const hidden = (this.hasReversedValue && this.reversedValue) ? checked : !checked;++ this+ .effectTargets+ .filter((el) => targetName === el.dataset.targetName)+ .forEach((el) => {+ if (el.dataset.setVisibility === 'true') {+ el.style.setProperty('visibility', hidden ? 'hidden' : 'visible');+ } else if (el.dataset.visibilityClass) {+ el.classList.toggle(el.dataset.visibilityClass, hidden);+ } else {+ el.hidden = hidden;+ }+ });}}diff --git a/spec/support/pages/admin/settings/project_life_cycle_step_definitions.rb b/spec/support/pages/admin/settings/project_life_cycle_step_definitions.rbindex 286647cca45..f9e8d710900 100644--- a/spec/support/pages/admin/settings/project_life_cycle_step_definitions.rb+++ b/spec/support/pages/admin/settings/project_life_cycle_step_definitions.rb@@ -58,7 +58,7 @@ module Pagesenddef filter_with(string)- fill_in I18n.t("settings.project_life_cycle_step_definitions.filter.label"), with: string+ fill_in I18n.t("settings.project_phase_definitions.filter.label"), with: stringenddef clear_filter