|
1 | 1 | <%=
|
2 |
| -flex_layout do |flex| |
3 |
| - flex.with_row(flex_layout: true, justify_content: :space_between, align_items: :center) do |row| |
4 |
| - row.with_column do |
5 |
| - render(WorkPackages::InfoLineComponent.new(work_package: related_work_package)) |
6 |
| - end |
| 2 | + flex_layout do |flex| |
| 3 | + if visible? |
| 4 | + flex.with_row(flex_layout: true, justify_content: :space_between, align_items: :center) do |row| |
| 5 | + row.with_column do |
| 6 | + render(WorkPackages::InfoLineComponent.new(work_package: related_work_package)) |
| 7 | + end |
7 | 8 |
|
8 |
| - if should_render_action_menu? |
9 |
| - row.with_column do |
10 |
| - render(Primer::Alpha::ActionMenu.new(test_selector: action_menu_test_selector)) do |menu| |
11 |
| - menu.with_show_button(icon: "kebab-horizontal", |
12 |
| - "aria-label": I18n.t(:label_relation_actions), |
13 |
| - scheme: :invisible, |
14 |
| - ml: 2) |
| 9 | + if should_render_action_menu? |
| 10 | + row.with_column do |
| 11 | + render(Primer::Alpha::ActionMenu.new(test_selector: action_menu_test_selector)) do |menu| |
| 12 | + menu.with_show_button(icon: "kebab-horizontal", |
| 13 | + "aria-label": I18n.t(:label_relation_actions), |
| 14 | + scheme: :invisible, |
| 15 | + ml: 2) |
15 | 16 |
|
16 |
| - if should_render_edit_option? |
17 |
| - menu.with_item(label: I18n.t(:label_relation_edit), |
18 |
| - href: edit_path, |
19 |
| - test_selector: edit_button_test_selector, |
20 |
| - content_arguments: { |
21 |
| - data: { turbo_stream: true } |
22 |
| - }) do |item| |
23 |
| - item.with_leading_visual_icon(icon: :pencil) |
24 |
| - end |
25 |
| - end |
| 17 | + if should_render_edit_option? |
| 18 | + menu.with_item(label: I18n.t(:label_relation_edit), |
| 19 | + href: edit_path, |
| 20 | + test_selector: edit_button_test_selector, |
| 21 | + content_arguments: { |
| 22 | + data: { turbo_stream: true } |
| 23 | + }) do |item| |
| 24 | + item.with_leading_visual_icon(icon: :pencil) |
| 25 | + end |
| 26 | + end |
26 | 27 |
|
27 |
| - menu.with_item(label: I18n.t(:label_relation_delete), |
28 |
| - scheme: :danger, |
29 |
| - href: destroy_path, |
30 |
| - form_arguments: { |
31 |
| - method: :delete, |
32 |
| - data: { |
33 |
| - confirm: t("text_are_you_sure"), |
34 |
| - turbo_stream: true, |
35 |
| - update_work_package: true |
36 |
| - } |
37 |
| - }, |
38 |
| - test_selector: delete_button_test_selector) do |item| |
39 |
| - item.with_leading_visual_icon(icon: :trash) |
| 28 | + menu.with_item(label: I18n.t(:label_relation_delete), |
| 29 | + scheme: :danger, |
| 30 | + href: destroy_path, |
| 31 | + form_arguments: { |
| 32 | + method: :delete, |
| 33 | + data: { |
| 34 | + confirm: t("text_are_you_sure"), |
| 35 | + turbo_stream: true, |
| 36 | + update_work_package: true |
| 37 | + } |
| 38 | + }, |
| 39 | + test_selector: delete_button_test_selector) do |item| |
| 40 | + item.with_leading_visual_icon(icon: :trash) |
| 41 | + end |
| 42 | + end |
40 | 43 | end
|
41 | 44 | end
|
42 | 45 | end
|
43 |
| - end |
44 |
| - end |
45 | 46 |
|
46 |
| - flex.with_row(mb: 2) do |
47 |
| - render(Primer::Beta::Link.new(href: work_package_path(related_work_package), |
48 |
| - color: :default, |
49 |
| - underline: false, |
50 |
| - font_size: :normal, |
51 |
| - font_weight: :bold, |
52 |
| - target: "_blank")) { related_work_package.subject } |
53 |
| - end |
54 |
| - |
55 |
| - if should_display_description? |
56 |
| - flex.with_row(mb: 2) do |
57 |
| - render(Primer::Beta::Text.new(font_size: :small, color: :muted)) { format_text(relation, :description) } |
58 |
| - end |
59 |
| - end |
| 47 | + flex.with_row(mb: 2) do |
| 48 | + render(Primer::Beta::Link.new(href: work_package_path(related_work_package), |
| 49 | + color: :default, |
| 50 | + underline: false, |
| 51 | + font_size: :normal, |
| 52 | + font_weight: :bold, |
| 53 | + target: "_blank")) { related_work_package.subject } |
| 54 | + end |
60 | 55 |
|
61 |
| - if should_display_dates_row? |
62 |
| - flex.with_row(flex_layout: true, align_items: :center, color: :muted, mb: 2) do |dates_row| |
63 |
| - if precedes? && lag_present? |
64 |
| - dates_row.with_column(mr: 1) do |
65 |
| - render(Primer::Beta::Octicon.new(icon: "arrow-both")) |
| 56 | + if should_display_description? |
| 57 | + flex.with_row(mb: 2) do |
| 58 | + render(Primer::Beta::Text.new(font_size: :small, color: :muted)) { format_text(relation, :description) } |
66 | 59 | end
|
67 |
| - dates_row.with_column(mr: 3) do |
68 |
| - render(Primer::Beta::Text.new) do |
69 |
| - lag_as_text(relation.lag) |
70 |
| - end |
| 60 | + end |
| 61 | + else |
| 62 | + flex.with_row(mb: 2) do |
| 63 | + render(Primer::Beta::Text.new(font_weight: :bold, color: :muted)) { I18n.t("work_package_relations_tab.relations.ghost_relation_title") } |
| 64 | + end |
| 65 | + flex.with_row(flex_layout: true, align_items: :center, color: :muted, mb: 2) do |ghost_description_row| |
| 66 | + ghost_description_row.with_column(mr: 1) do |
| 67 | + render(Primer::Beta::Octicon.new(icon: "alert")) |
| 68 | + end |
| 69 | + ghost_description_row.with_column do |
| 70 | + render(Primer::Beta::Text.new) { I18n.t("work_package_relations_tab.relations.ghost_relation_description") } |
71 | 71 | end
|
72 | 72 | end
|
| 73 | + end |
73 | 74 |
|
74 |
| - if related_work_package.start_date.present? || related_work_package.due_date.present? |
75 |
| - dates_row.with_column(mr: 1) do |
76 |
| - icon = if follows? |
77 |
| - :calendar |
78 |
| - elsif precedes? |
79 |
| - :pin |
80 |
| - end |
| 75 | + # Show dates for both visible and ghost relation |
| 76 | + if should_display_dates_row? |
| 77 | + flex.with_row(flex_layout: true, align_items: :center, color: :muted, mb: 2) do |dates_row| |
| 78 | + if precedes? && lag_present? |
| 79 | + dates_row.with_column(mr: 1) { render(Primer::Beta::Octicon.new(icon: "arrow-both")) } |
| 80 | + dates_row.with_column(mr: 2) { render(Primer::Beta::Text.new) { lag_as_text(relation.lag) } } |
| 81 | + end |
81 | 82 |
|
82 |
| - render(Primer::Beta::Octicon.new(icon:)) |
| 83 | + dates_row.with_column(mr: 1) do |
| 84 | + render(Primer::Beta::Octicon.new(icon: helpers.work_package_dates_icon(related_work_package))) |
83 | 85 | end
|
84 | 86 | dates_row.with_column do
|
85 |
| - render(Primer::Beta::Text.new) do |
86 |
| - "#{format_date(related_work_package.start_date)} - #{format_date(related_work_package.due_date)}" |
87 |
| - end |
| 87 | + render(Primer::Beta::Text.new) { helpers.work_package_formatted_dates(related_work_package) } |
88 | 88 | end
|
89 |
| - end |
90 | 89 |
|
91 |
| - if follows? && lag_present? |
92 |
| - dates_row.with_column(ml: 3, mr: 1) do |
93 |
| - render(Primer::Beta::Octicon.new(icon: "arrow-both")) |
94 |
| - end |
95 |
| - dates_row.with_column(mr: 1) do |
96 |
| - render(Primer::Beta::Text.new) do |
97 |
| - lag_as_text(relation.lag) |
98 |
| - end |
| 90 | + if follows? && lag_present? |
| 91 | + dates_row.with_column(ml: 2, mr: 1) { render(Primer::Beta::Octicon.new(icon: "arrow-both")) } |
| 92 | + dates_row.with_column(mr: 1) { render(Primer::Beta::Text.new) { lag_as_text(relation.lag) } } |
99 | 93 | end
|
100 | 94 | end
|
101 | 95 | end
|
102 | 96 | end
|
103 |
| -end |
104 | 97 | %>
|
0 commit comments