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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#59540] Highlight closest relation in relations tab
Alexander Brandon Coles7fe4b4f5f742
diff --git a/app/components/work_package_relations_tab/index_component.html.erb b/app/components/work_package_relations_tab/index_component.html.erbindex 30624f9de36..a087cd35bf9 100644--- a/app/components/work_package_relations_tab/index_component.html.erb+++ b/app/components/work_package_relations_tab/index_component.html.erb@@ -69,7 +69,8 @@WorkPackageRelationsTab::RelationComponent.new(work_package: work_package,relation: relation,- visibility: visibility+ visibility: visibility,+ closest: relation_group.closest_relation?(relation)))enddiff --git a/app/components/work_package_relations_tab/relation_component.html.erb b/app/components/work_package_relations_tab/relation_component.html.erbindex 8abb42f131e..303a2a5d1e0 100644--- a/app/components/work_package_relations_tab/relation_component.html.erb+++ b/app/components/work_package_relations_tab/relation_component.html.erb@@ -87,9 +87,14 @@render(Primer::Beta::Text.new) { helpers.work_package_formatted_dates(related_work_package) }end- if follows? && lag_present?- dates_row.with_column(ml: 2, mr: 1) { render(Primer::Beta::Octicon.new(icon: "arrow-both")) }- dates_row.with_column(mr: 1) { render(Primer::Beta::Text.new) { lag_as_text(relation.lag) } }+ if follows?+ if lag_present?+ dates_row.with_column(ml: 2, mr: 1) { render(Primer::Beta::Octicon.new(icon: "arrow-both")) }+ dates_row.with_column(mr: 1) { render(Primer::Beta::Text.new) { lag_as_text(relation.lag) } }+ end+ if closest?+ dates_row.with_column(ml: 2, mr: 1) { render(Primer::Beta::Label.new(scheme: :primary, inline: true)) { I18n.t("work_package_relations_tab.relations.label_closest") } }+ endendendenddiff --git a/app/components/work_package_relations_tab/relation_component.rb b/app/components/work_package_relations_tab/relation_component.rbindex 3179a301310..8bdcdbcaae3 100644--- a/app/components/work_package_relations_tab/relation_component.rb+++ b/app/components/work_package_relations_tab/relation_component.rb@@ -11,11 +11,13 @@ class WorkPackageRelationsTab::RelationComponent < ApplicationComponent# @param visibility [Symbol] The visibility status of the relation (:visible or :ghost)# @param child [WorkPackage, nil] The child work package, if this is a parent-child relationship# @param editable [Boolean] Whether the relation can be edited+ # @param closest [Boolean] Whether the follows relation is the closestdef initialize(work_package:,relation:,visibility:,child: nil,- editable: true)+ editable: true,+ closest: false)super()@work_package = work_package@@ -23,6 +25,7 @@ class WorkPackageRelationsTab::RelationComponent < ApplicationComponent@visibility = visibility@child = child@editable = editable+ @closest = closestenddef related_work_package@@ -98,6 +101,10 @@ class WorkPackageRelationsTab::RelationComponent < ApplicationComponentrelation.relation_type_for(work_package) == Relation::TYPE_PRECEDESend+ def closest?+ @closest+ end+def edit_pathif parent_child_relationship?raise NotImplementedError, "Children relationships are not editable"diff --git a/app/components/work_packages/date_picker/dialog_content_component.html.erb b/app/components/work_packages/date_picker/dialog_content_component.html.erbindex 2f15b03caa3..b66f0c9296a 100644--- a/app/components/work_packages/date_picker/dialog_content_component.html.erb+++ b/app/components/work_packages/date_picker/dialog_content_component.html.erb@@ -53,7 +53,8 @@relation: (relation unless relation_group.children_type?),visibility: :visible,child: (relation if relation_group.children_type?),- editable: false+ editable: false,+ closest: relation_group.closest_relation?(relation)))end@@ -66,7 +67,8 @@relation: (relation unless relation_group.children_type?),visibility: :ghost,child: (relation if relation_group.children_type?),- editable: false+ editable: false,+ closest: relation_group.closest_relation?(relation)))enddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex 94cf5cf3d91..424ce9bd3ba 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -825,6 +825,7 @@ en:new_child_text: "Creates a related work package as a sub-item of the current (parent) work package"existing_child: "Existing child"child_description: "Makes the related work package a sub-item of the current (parent) work package"+ label_closest: "Closest"label_blocks_singular: "blocks"label_blocks_plural: "blocks"blocks_description: "The related work package cannot be closed until this one is closed first"