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 title and description for ghost relation

Behrokh Satarnejad3719acd6f4fb
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 0f32d04902d..6f02b0912f8 100644
--- a/app/components/work_package_relations_tab/relation_component.html.erb
+++ b/app/components/work_package_relations_tab/relation_component.html.erb
@@ -1,105 +1,119 @@
-<%= visibility %>
<%=
-flex_layout do |flex|
- flex.with_row(flex_layout: true, justify_content: :space_between, align_items: :center) do |row|
- row.with_column do
- render(WorkPackages::InfoLineComponent.new(work_package: related_work_package))
- end
+ flex_layout do |flex|
+ if visible?
+ flex.with_row(flex_layout: true, justify_content: :space_between, align_items: :center) do |row|
+ row.with_column do
+ render(WorkPackages::InfoLineComponent.new(work_package: related_work_package))
+ end
- if should_render_action_menu?
- row.with_column do
- render(Primer::Alpha::ActionMenu.new(test_selector: action_menu_test_selector)) do |menu|
- menu.with_show_button(icon: "kebab-horizontal",
- "aria-label": I18n.t(:label_relation_actions),
- scheme: :invisible,
- ml: 2)
+ if should_render_action_menu?
+ row.with_column do
+ render(Primer::Alpha::ActionMenu.new(test_selector: action_menu_test_selector)) do |menu|
+ menu.with_show_button(icon: "kebab-horizontal",
+ "aria-label": I18n.t(:label_relation_actions),
+ scheme: :invisible,
+ ml: 2)
- if should_render_edit_option?
- menu.with_item(label: "Edit relation",
- href: edit_path,
- test_selector: edit_button_test_selector,
- content_arguments: {
- data: { turbo_stream: true }
- }) do |item|
- item.with_leading_visual_icon(icon: :pencil)
- end
- end
+ if should_render_edit_option?
+ menu.with_item(label: "Edit relation",
+ href: edit_path,
+ test_selector: edit_button_test_selector,
+ content_arguments: {
+ data: { turbo_stream: true }
+ }) do |item|
+ item.with_leading_visual_icon(icon: :pencil)
+ end
+ end
- menu.with_item(label: "Delete relation",
- scheme: :danger,
- href: destroy_path,
- form_arguments: {
- method: :delete,
- data: {
- confirm: t("text_are_you_sure"),
- turbo_stream: true,
- update_work_package: true
- }
- },
- test_selector: delete_button_test_selector) do |item|
- item.with_leading_visual_icon(icon: :trash)
+ menu.with_item(label: "Delete relation",
+ scheme: :danger,
+ href: destroy_path,
+ form_arguments: {
+ method: :delete,
+ data: {
+ confirm: t("text_are_you_sure"),
+ turbo_stream: true,
+ update_work_package: true
+ }
+ },
+ test_selector: delete_button_test_selector) do |item|
+ item.with_leading_visual_icon(icon: :trash)
+ end
+ end
end
end
end
- end
- end
- flex.with_row(mb: 2) do
- render(Primer::Beta::Link.new(href: work_package_path(related_work_package),
- color: :default,
- underline: false,
- font_size: :normal,
- font_weight: :bold,
- target: "_blank")) { related_work_package.subject }
- end
+ flex.with_row(mb: 2) do
+ render(Primer::Beta::Link.new(href: work_package_path(related_work_package),
+ color: :default,
+ underline: false,
+ font_size: :normal,
+ font_weight: :bold,
+ target: "_blank")) { related_work_package.subject }
+ end
- if should_display_description?
- flex.with_row(mb: 2) do
- render(Primer::Beta::Text.new(font_size: :small, color: :muted)) { format_text(relation, :description) }
+ if should_display_description?
+ flex.with_row(mb: 2) do
+ render(Primer::Beta::Text.new(font_size: :small, color: :muted)) { format_text(relation, :description) }
+ end
+ end
+ else
+ flex.with_row(mb: 2) do
+ render(Primer::Beta::Text.new(font_weight: :bold, color: :muted)) { I18n.t("work_package_relations_tab.relations.ghost_relation_title") }
+ end
+ flex.with_row(flex_layout: true, align_items: :center, color: :muted, mb: 2) do |ghost_description_row|
+ ghost_description_row.with_column(mr: 1) do
+ render(Primer::Beta::Octicon.new(icon: "alert"))
+ end
+ ghost_description_row.with_column do
+ render(Primer::Beta::Text.new) { I18n.t("work_package_relations_tab.relations.ghost_relation_description") }
+ end
+ end
end
- end
- if should_display_dates_row?
- flex.with_row(flex_layout: true, align_items: :center, color: :muted, mb: 2) do |dates_row|
- if precedes? && lag_present?
- dates_row.with_column(mr: 1) do
- render(Primer::Beta::Octicon.new(icon: "arrow-both"))
- end
- dates_row.with_column(mr: 3) do
- render(Primer::Beta::Text.new) do
- lag_as_text(relation.lag)
+ # Show dates for both visible and ghost relation
+ if should_display_dates_row?
+ flex.with_row(flex_layout: true, align_items: :center, color: :muted, mb: 2) do |dates_row|
+ if precedes? && lag_present?
+ dates_row.with_column(mr: 1) do
+ render(Primer::Beta::Octicon.new(icon: "arrow-both"))
+ end
+ dates_row.with_column(mr: 3) do
+ render(Primer::Beta::Text.new) do
+ lag_as_text(relation.lag)
+ end
end
end
- end
- if related_work_package.start_date.present? || related_work_package.due_date.present?
- dates_row.with_column(mr: 1) do
- icon = if follows?
- :calendar
- elsif precedes?
- :pin
- end
+ if related_work_package.start_date.present? || related_work_package.due_date.present?
+ dates_row.with_column(mr: 1) do
+ icon = if follows?
+ :calendar
+ elsif precedes?
+ :pin
+ end
- render(Primer::Beta::Octicon.new(icon:))
- end
- dates_row.with_column do
- render(Primer::Beta::Text.new) do
- "#{format_date(related_work_package.start_date)} - #{format_date(related_work_package.due_date)}"
+ render(Primer::Beta::Octicon.new(icon:))
+ end
+ dates_row.with_column do
+ render(Primer::Beta::Text.new) do
+ "#{format_date(related_work_package.start_date)} - #{format_date(related_work_package.due_date)}"
+ end
end
end
- end
- if follows? && lag_present?
- dates_row.with_column(ml: 3, mr: 1) do
- render(Primer::Beta::Octicon.new(icon: "arrow-both"))
- end
- dates_row.with_column(mr: 1) do
- render(Primer::Beta::Text.new) do
- lag_as_text(relation.lag)
+ if follows? && lag_present?
+ dates_row.with_column(ml: 3, mr: 1) do
+ render(Primer::Beta::Octicon.new(icon: "arrow-both"))
+ end
+ dates_row.with_column(mr: 1) do
+ render(Primer::Beta::Text.new) do
+ lag_as_text(relation.lag)
+ end
end
end
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 73d298f256c..0aa0a0624e0 100644
--- a/app/components/work_package_relations_tab/relation_component.rb
+++ b/app/components/work_package_relations_tab/relation_component.rb
@@ -34,8 +34,6 @@ class WorkPackageRelationsTab::RelationComponent < ApplicationComponent
end
def should_render_action_menu?
- return false unless visible?
-
if parent_child_relationship?
allowed_to_manage_subtasks?
else
diff --git a/config/locales/en.yml b/config/locales/en.yml
index ff3744163eb..87a07e152e7 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -799,6 +799,8 @@ en:
label_parent_singular: "parent"
label_parent_plural: "parent"
+ ghost_relation_title: "Related work package"
+ ghost_relation_description: "This is not visible to you due to permissions."
label_invitation: Invitation
account: