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

Sort hierarchy items by the name they are displayed with

Jan Sandbrinkbc56e855a2eb
diff --git a/app/forms/custom_fields/inputs/multi_select_list.rb b/app/forms/custom_fields/inputs/multi_select_list.rb
index a280c24861e..2a1a756c376 100644
--- a/app/forms/custom_fields/inputs/multi_select_list.rb
+++ b/app/forms/custom_fields/inputs/multi_select_list.rb
@@ -82,6 +82,7 @@ class CustomFields::Inputs::MultiSelectList < CustomFields::Inputs::Base::Autoco
CustomFields::Hierarchy::HierarchicalItemService.new
.get_descendants(item: @custom_field.hierarchy_root, include_self: false)
.value_or([])
+ .sort_by(&:ancestry_path)
end
def selected?(custom_option)
diff --git a/app/forms/custom_fields/inputs/single_select_list.rb b/app/forms/custom_fields/inputs/single_select_list.rb
index 8030485f635..0e1edc4944c 100644
--- a/app/forms/custom_fields/inputs/single_select_list.rb
+++ b/app/forms/custom_fields/inputs/single_select_list.rb
@@ -77,6 +77,7 @@ class CustomFields::Inputs::SingleSelectList < CustomFields::Inputs::Base::Autoc
CustomFields::Hierarchy::HierarchicalItemService.new
.get_descendants(item: @custom_field.hierarchy_root, include_self: false)
.value_or([])
+ .sort_by(&:ancestry_path)
end
def selected?(custom_option)