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

display life cycle type next to name

ulfertsfc3b99b6f0c0
diff --git a/app/components/projects/life_cycle_type_component.html.erb b/app/components/projects/life_cycle_type_component.html.erb
new file mode 100644
index 00000000000..dc294093ebb
--- /dev/null
+++ b/app/components/projects/life_cycle_type_component.html.erb
@@ -0,0 +1,9 @@
+<%= flex_layout(align_items: :center,
+ justify_content: :space_between) do |element_container|
+ element_container.with_column(mr: 1, style: "color: #{icon_color}") do
+ render Primer::Beta::Octicon.new(icon: icon)
+ end
+ element_container.with_column do
+ render(Primer::Beta::Text.new(**text_options)) { text }
+ end
+end %>
diff --git a/app/components/projects/life_cycle_type_component.rb b/app/components/projects/life_cycle_type_component.rb
new file mode 100644
index 00000000000..175a6a9decd
--- /dev/null
+++ b/app/components/projects/life_cycle_type_component.rb
@@ -0,0 +1,57 @@
+# 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
+ class LifeCycleTypeComponent < ApplicationComponent
+ include OpPrimer::ComponentHelpers
+
+ def text
+ model.model_name.human
+ end
+
+ def icon
+ case model
+ when Stage
+ :"git-commit"
+ when Gate
+ :diamond
+ else
+ raise NotImplementedError, "Unknown model #{model.class} to render a LifeCycleTypeComponent with"
+ end
+ end
+
+ def icon_color
+ model.color.hexcode
+ end
+
+ def text_options
+ { color: :muted }.merge(options)
+ end
+ end
+end
diff --git a/app/components/projects/settings/life_cycles/element_component.html.erb b/app/components/projects/settings/life_cycles/element_component.html.erb
index b992db25d90..dd66c23f679 100644
--- a/app/components/projects/settings/life_cycles/element_component.html.erb
+++ b/app/components/projects/settings/life_cycles/element_component.html.erb
@@ -3,9 +3,12 @@
flex_layout(align_items: :center,
justify_content: :space_between) do |element_container|
element_container.with_column(flex_layout: true) do |title_container|
- title_container.with_column(pt: 1, mr: 2) do
+ title_container.with_column(pt: 1, mr: 3) do
render(Primer::Beta::Text.new) { element.name }
end
+ title_container.with_column(pt: 1) do
+ render(Projects::LifeCycleTypeComponent.new(element))
+ end
end
# 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
diff --git a/config/locales/en.yml b/config/locales/en.yml
index c9bc5bc2844..de7ba2875a2 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1401,6 +1401,7 @@ en:
custom_field: "Custom field"
"doorkeeper/application": "OAuth application"
forum: "Forum"
+ gate: "Gate"
global_role: "Global role"
group: "Group"
member: "Member"
@@ -1418,6 +1419,7 @@ en:
one: "Role"
other: "Roles"
status: "Work package status"
+ stage: "Stage"
token/api:
one: Access token
other: Access tokens