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

Forbid editing the relations in the datepicker

Henriette Darge17b8d3baf8b5
diff --git a/app/components/work_package_relations_tab/relation_component.rb b/app/components/work_package_relations_tab/relation_component.rb
index ee85a705031..ba0ca90ed38 100644
--- a/app/components/work_package_relations_tab/relation_component.rb
+++ b/app/components/work_package_relations_tab/relation_component.rb
@@ -2,18 +2,20 @@ class WorkPackageRelationsTab::RelationComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers
- attr_reader :work_package, :relation, :child, :visibility
+ attr_reader :work_package, :relation, :visibility, :child, :editable
def initialize(work_package:,
relation:,
visibility:,
- child: nil)
+ child: nil,
+ editable: true)
super()
@work_package = work_package
@relation = relation
@visibility = visibility
@child = child
+ @editable = editable
end
def related_work_package
@@ -34,6 +36,8 @@ class WorkPackageRelationsTab::RelationComponent < ApplicationComponent
end
def should_render_action_menu?
+ return false unless editable
+
if parent_child_relationship?
allowed_to_manage_subtasks?
else
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.erb
index 96124d1026c..4f935d071a9 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
@@ -103,7 +103,8 @@
follow_relations.each do |relation|
component.with_row(scheme: :default) do
render(WorkPackageRelationsTab::RelationComponent.new(work_package:,
- relation:))
+ relation:,
+ editable: false))
end
end
end
@@ -118,7 +119,8 @@
precedes_relations.each do |relation|
component.with_row(scheme: :default) do
render(WorkPackageRelationsTab::RelationComponent.new(work_package:,
- relation:))
+ relation:,
+ editable: false))
end
end
end
@@ -134,7 +136,8 @@
component.with_row(scheme: :default) do
render(WorkPackageRelationsTab::RelationComponent.new(work_package:,
relation: nil,
- child:))
+ child:,
+ editable: false))
end
end
end