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

Render start and end dates for successor relationships

Aaron Contrerasaf9200a8b54c
diff --git a/app/components/work_package_relations_tab/relation_component.html.erb b/app/components/work_package_relations_tab/relation_component.html.erb
index 13c8366e386..fba5021d583 100644
--- a/app/components/work_package_relations_tab/relation_component.html.erb
+++ b/app/components/work_package_relations_tab/relation_component.html.erb
@@ -59,16 +59,23 @@
end
end
- if parent_child_relationship? && child.description.present?
+ if should_display_description?
flex.with_row(flex_layout: true, justify_content: :flex_start) do |description_row|
description_row.with_column do
- render(Primer::Beta::Text.new(font_size: :small, color: :muted)) { format_text(child, :description) }
+ render(Primer::Beta::Text.new(font_size: :small, color: :muted)) { format_text(relation, :description) }
end
end
- elsif !parent_child_relationship? && relation.description.present?
- flex.with_row(flex_layout: true, justify_content: :flex_start) do |description_row|
- description_row.with_column do
- render(Primer::Beta::Text.new(font_size: :small, color: :muted)) { format_text(relation, :description) }
+ end
+
+ if should_display_start_and_end_dates?
+ flex.with_row(flex_layout: true, justify_content: :flex_start, align_items: :center, style: "gap: 0.25rem;") do |start_and_end_dates_row|
+ start_and_end_dates_row.with_column do
+ render(Primer::Beta::Octicon.new(icon: :calendar, color: :muted))
+ end
+ start_and_end_dates_row.with_column do
+ render(Primer::Beta::Text.new(color: :muted)) do
+ format_date(related_work_package.start_date) + " - " + format_date(related_work_package.due_date)
+ end
end
end
end
diff --git a/app/components/work_package_relations_tab/relation_component.rb b/app/components/work_package_relations_tab/relation_component.rb
index 6d80d2a4b5c..19bf080a096 100644
--- a/app/components/work_package_relations_tab/relation_component.rb
+++ b/app/components/work_package_relations_tab/relation_component.rb
@@ -34,6 +34,18 @@ class WorkPackageRelationsTab::RelationComponent < ApplicationComponent
end
end
+ def should_display_description?
+ return false if parent_child_relationship?
+
+ relation.description.present?
+ end
+
+ def should_display_start_and_end_dates?
+ return false if parent_child_relationship?
+
+ relation.follows? || relation.precedes?
+ end
+
def edit_path
if parent_child_relationship?
raise NotImplementedError, "Children relationships are not editable"