-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
Copy pathitem_component.html.erb
157 lines (154 loc) · 7.18 KB
/
item_component.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<%=
component_wrapper(data: wrapper_data_attributes, class: "work-packages-activities-tab-journals-item-component") do
flex_layout(
data: {
test_selector: "op-wp-journal-entry-#{journal.id}"
}
) do |journal_container|
if show_comment_container?
journal_container.with_row do
render(
border_box_container(
padding: :condensed,
"aria-label": I18n.t("activities.work_packages.activity_tab.commented"),
data: {
"anchor-activity-id": journal.sequence_version,
"anchor-comment-id": journal.id
},
classes: container_classes
)
) do |border_box_component|
border_box_component.with_header(
px: 2, py: 1,
data: { test_selector: "op-journal-notes-header" },
classes: comment_header_classes
) do
flex_layout(align_items: :center, justify_content: :space_between) do |header_container|
header_container.with_column(
flex_layout: true,
classes: "work-packages-activities-tab-journals-item-component--header-start-container ellipsis"
) do |header_start_container|
header_start_container.with_column(mr: 2) do
render Users::AvatarComponent.new(user: journal.user, show_name: false, size: :mini)
end
header_start_container.with_column(
mr: 1, flex_layout: true,
classes: "work-packages-activities-tab-journals-item-component--user-name-container hidden-for-desktop"
) do |user_name_container|
user_name_container.with_row(classes: "work-packages-activities-tab-journals-item-component--user-name ellipsis") do
truncated_user_name(journal.user)
end
user_name_container.with_row do
render(Primer::Beta::Text.new(font_size: :small, color: :subtle, mt: 1)) { format_time(journal.created_at) }
end
end
header_start_container.with_column(
mr: 1,
classes: "work-packages-activities-tab-journals-item-component--user-name ellipsis hidden-for-mobile"
) do
truncated_user_name(journal.user, hover_card: true)
end
if journal.initial?
header_start_container.with_column(
mr: 1,
classes: "work-packages-activities-tab-journals-item-component-details--journal-type hidden-for-mobile"
) do
render(Primer::Beta::Text.new(font_size: :small, color: :subtle, mt: 1)) do
I18n.t("activities.work_packages.activity_tab.created_on")
end
end
end
header_start_container.with_column(mr: 1, classes: "hidden-for-mobile") do
if OpenProject::FeatureDecisions.work_package_comment_id_url_active?
activity_anchor_link(journal) { journal_updated_at_formatted_time(journal) }
else
journal_updated_at_formatted_time(journal)
end
end
end
header_container.with_column(flex_layout: true, align_items: :center) do |header_end_container|
if has_unread_notifications?
header_end_container.with_column(mr: 2) do
render(
Primer::Beta::Octicon.new(
:"dot-fill", # color is set via CSS as requested by UI/UX Team
classes: "work-packages-activities-tab-journals-item-component--notification-dot-icon",
size: (OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? ? :small : :medium),
data: { test_selector: "op-journal-unread-notification", "op-ian-center-update-immediate": true }
)
)
end
end
if journal.restricted?
header_end_container.with_column(mr: 2) do
render(
Primer::Beta::Octicon.new(
:lock,
classes: "work-packages-activities-tab-journals-item-component--restricted-icon",
size: :small,
aria: { label: I18n.t("activities.work_packages.activity_tab.restricted_journal") },
data: { test_selector: "op-journal-restricted-icon" },
color: (journal.restricted? ? :attention : :default)
)
)
end
end
unless OpenProject::FeatureDecisions.work_package_comment_id_url_active?
header_end_container.with_column do
activity_anchor_link(journal)
end
end
header_end_container.with_column(
ml: 1,
classes: "work-packages-activities-tab-journals-item-component--action-menu"
) do
render(Primer::Alpha::ActionMenu.new(data: { test_selector: "op-wp-journal-#{journal.id}-action-menu" })) do |menu|
menu.with_show_button(
icon: "kebab-horizontal",
"aria-label": I18n.t(:button_actions),
scheme: :invisible
)
copy_url_action_item(menu)
edit_action_item(menu) if allowed_to_edit?
quote_action_item(menu) if journal.notes.present? && allowed_to_quote?
end
end
end
end
end
border_box_component.with_body(
classes: comment_body_classes,
data: { test_selector: "op-journal-notes-body" }
) do
if noop?
render(Primer::Beta::Text.new(font_style: :italic, color: :subtle, mt: 1)) do
I18n.t(:"journals.changes_retracted")
end
else
case state
when :show
render(
WorkPackages::ActivitiesTab::Journals::ItemComponent::Show.new(
journal:, filter:,
grouped_emoji_reactions:
)
)
when :edit
render(WorkPackages::ActivitiesTab::Journals::ItemComponent::Edit.new(journal:, filter:))
end
end
end
end
end
end
journal_container.with_row do
render(
WorkPackages::ActivitiesTab::Journals::ItemComponent::Details.new(
journal:,
has_unread_notifications: notification_on_details?, filter:
)
)
end
end
end
%>