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

basic index - list definitions

Ivan Kuchin425eda75c66d
diff --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.erb
new file mode 100644
index 00000000000..3780a5e3e8e
--- /dev/null
+++ b/app/components/settings/project_life_cycle_step_definitions/index_component.html.erb
@@ -0,0 +1,84 @@
+<%#-- 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.
+
+++#%>
+
+<%=
+ flex_layout(data: wrapper_data_attributes) do |flex|
+ flex.with_row do
+ 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"),
+ visually_hide_label: true,
+ placeholder: t("settings.project_life_cycle_step_definitions.filter.label"),
+ leading_visual: {
+ icon: :search,
+ size: :small
+ },
+ show_clear_button: true,
+ data: {
+ action: "input->projects--settings--border-box-filter#filterLists",
+ "projects--settings--border-box-filter-target": "filter"
+ }
+ )
+ end
+ end
+
+ flex.with_row do
+ render(border_box_container(mb: 3)) do |component|
+ component.with_header(font_weight: :bold, py: 2) do
+ flex_layout(justify_content: :space_between, align_items: :center) do |header_container|
+ header_container.with_column do
+ render(Primer::Beta::Text.new(font_weight: :bold)) do
+ I18n.t("settings.project_life_cycle_step_definitions.section_header")
+ end
+ end
+ end
+ end
+ if definitions.empty?
+ component.with_row do
+ render(Primer::Beta::Text.new(color: :subtle)) do
+ t("settings.project_life_cycle_step_definitions.non_defined")
+ end
+ end
+ else
+ definitions.each do |definition|
+ component.with_row(data: { "projects--settings--border-box-filter-target": "searchItem" }) do
+ render(Settings::ProjectLifeCycleStepDefinitions::RowComponent.new(definition))
+ end
+ end
+ end
+ end
+ end
+ flex.with_row(display: :none, data: { "projects--settings--border-box-filter-target": "noResultsText" }) do
+ render Primer::Beta::Text.new do
+ I18n.t("js.autocompleter.notFoundText")
+ end
+ end
+ end
+%>
diff --git a/app/components/settings/project_life_cycle_step_definitions/index_component.rb b/app/components/settings/project_life_cycle_step_definitions/index_component.rb
new file mode 100644
index 00000000000..107f81e0aed
--- /dev/null
+++ b/app/components/settings/project_life_cycle_step_definitions/index_component.rb
@@ -0,0 +1,46 @@
+#-- 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 Settings
+ module ProjectLifeCycleStepDefinitions
+ class IndexComponent < ApplicationComponent
+ include OpPrimer::ComponentHelpers
+
+ options :definitions
+
+ private
+
+ def wrapper_data_attributes
+ {
+ controller: "projects--settings--border-box-filter",
+ "application-target": "dynamic"
+ }
+ end
+ end
+ end
+end
diff --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.erb
new file mode 100644
index 00000000000..711efabbe01
--- /dev/null
+++ b/app/components/settings/project_life_cycle_step_definitions/row_component.html.erb
@@ -0,0 +1,48 @@
+<%#-- 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.
+
+++#%>
+
+<%=
+ flex_layout(align_items: :center,
+ justify_content: :space_between) do |step_container|
+ step_container.with_column(flex_layout: true) do |title_container|
+ title_container.with_column(pt: 1, mr: 3) do
+ render(Primer::Beta::Link.new(
+ classes: 'filter-target-visible-text',
+ href: edit_admin_settings_project_life_cycle_step_definition_path(definition),
+ font_weight: :bold
+ )) do
+ definition.name
+ end
+ end
+ title_container.with_column(pt: 1) do
+ render(Projects::LifeCycleTypeComponent.new(definition))
+ end
+ end
+ end
+%>
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.rb
new file mode 100644
index 00000000000..9d2ae086248
--- /dev/null
+++ b/app/components/settings/project_life_cycle_step_definitions/row_component.rb
@@ -0,0 +1,37 @@
+#-- 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 Settings
+ module ProjectLifeCycleStepDefinitions
+ class RowComponent < ApplicationComponent
+ include OpPrimer::ComponentHelpers
+
+ alias_method :definition, :model
+ end
+ end
+end
diff --git a/app/controllers/admin/settings/project_life_cycle_step_definitions_controller.rb b/app/controllers/admin/settings/project_life_cycle_step_definitions_controller.rb
index 1d7360c20fb..584804e477a 100644
--- a/app/controllers/admin/settings/project_life_cycle_step_definitions_controller.rb
+++ b/app/controllers/admin/settings/project_life_cycle_step_definitions_controller.rb
@@ -32,8 +32,11 @@ module Admin::Settings
before_action :check_feature_flag
+ before_action :find_definitions, only: %i[index]
before_action :find_definition, only: %i[edit update]
+ def index; end
+
def new_stage
@definition = Project::StageDefinition.new
@@ -76,6 +79,10 @@ module Admin::Settings
render_404 unless OpenProject::FeatureDecisions.stages_and_gates_active?
end
+ def find_definitions
+ @definitions = Project::LifeCycleStepDefinition.all
+ end
+
def find_definition
@definition = Project::LifeCycleStepDefinition.find(params[:id])
end
diff --git a/app/views/admin/settings/project_life_cycle_step_definitions/index.html.erb b/app/views/admin/settings/project_life_cycle_step_definitions/index.html.erb
index 24640627212..cf8877a719e 100644
--- a/app/views/admin/settings/project_life_cycle_step_definitions/index.html.erb
+++ b/app/views/admin/settings/project_life_cycle_step_definitions/index.html.erb
@@ -30,3 +30,4 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), t("settings.project_life_cycle_step_definitions.heading") %>
<%= render Settings::ProjectLifeCycleStepDefinitions::IndexHeaderComponent.new %>
+<%= render Settings::ProjectLifeCycleStepDefinitions::IndexComponent.new(definitions: @definitions) %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e5328e15e63..506099f83cd 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -3776,6 +3776,10 @@ en:
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"
+ non_defined: "Neither stages nor gates are currently defined."
new:
description: "Changes to this project step will be reflected in all projects where it is enabled."
new_stage: