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

show invisible children

Behrokh Satarnejad937b52fbb4b0
diff --git a/app/components/work_package_relations_tab/index_component.html.erb b/app/components/work_package_relations_tab/index_component.html.erb
index ad2cddb2127..855f2840999 100644
--- a/app/components/work_package_relations_tab/index_component.html.erb
+++ b/app/components/work_package_relations_tab/index_component.html.erb
@@ -82,19 +82,23 @@
end
# Children
- if children.any?
+ if any_children?
base_key = "#{key_namespace}.label_child"
+ # Combine visible and invisible children into a single list
+ all_children = visible_children.map { |r| [r, :visible] } +
+ invisible_children.map { |r| [r, :ghost] }
+
flex.with_row do
render_relation_group(
title: t("#{base_key}_plural").capitalize,
relation_type: :children,
- items: children
- ) do |child|
+ items: all_children
+ ) do |child, visibility|
render(WorkPackageRelationsTab::RelationComponent.new(work_package:,
relation: nil,
child:,
- visibility: :visible))
+ visibility: visibility))
end
end
end
diff --git a/app/components/work_package_relations_tab/index_component.rb b/app/components/work_package_relations_tab/index_component.rb
index 6a3b37d6bd3..5a053a75d2f 100644
--- a/app/components/work_package_relations_tab/index_component.rb
+++ b/app/components/work_package_relations_tab/index_component.rb
@@ -18,10 +18,11 @@ class WorkPackageRelationsTab::IndexComponent < ApplicationComponent
attr_reader :relations_mediator, :relation_to_scroll_to
delegate :work_package,
- :visible_relations,
- :children,
+ :visible_children,
+ :invisible_children,
:directionally_aware_grouped_relations,
:any_relations?,
+ :any_children?,
to: :relations_mediator
# Initialize the component with required data
#
diff --git a/app/components/work_package_relations_tab/relations_mediator.rb b/app/components/work_package_relations_tab/relations_mediator.rb
index d8032b2d959..54924791802 100644
--- a/app/components/work_package_relations_tab/relations_mediator.rb
+++ b/app/components/work_package_relations_tab/relations_mediator.rb
@@ -41,14 +41,18 @@ class WorkPackageRelationsTab::RelationsMediator
@visible_relations ||= work_package.relations.includes(:to, :from).visible
end
- def children
- @children ||= work_package.children.visible
+ def visible_children
+ @visible_children ||= work_package.children.visible
end
def invisible_relations
@invisible_relations = work_package.relations.includes(:to, :from).where.not(id: @visible_relations.select(:id))
end
+ def invisible_children
+ @invisible_children ||= work_package.children.where.not(id: @visible_children.select(:id))
+ end
+
def directionally_aware_grouped_relations
# Collect all unique relation types
all_relation_types = collect_all_relation_types
@@ -67,6 +71,10 @@ class WorkPackageRelationsTab::RelationsMediator
visible_relations.any? || invisible_relations.any? || children.any?
end
+ def any_children?
+ visible_children.any? || invisible_children.any?
+ end
+
private
def collect_all_relation_types