forked from hackorum-dev/hackorum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_message.html.slim
More file actions
98 lines (93 loc) · 5.42 KB
/
_message.html.slim
File metadata and controls
98 lines (93 loc) · 5.42 KB
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
- message_classes = [("reply-message" if message.reply_to_id), ("message-branch-#{local_assigns[:branch_index]}" unless local_assigns[:branch_index].nil?)].compact.join(" ")
.message-card id=message_dom_id(message) class=message_classes
- if (mid_anchor = message_id_anchor(message))
a.message-id-anchor id=mid_anchor aria-hidden="true"
- if local_assigns[:is_first_unread]
a.message-id-anchor id="first-unread" aria-hidden="true"
- display_number = number || (@message_numbers && @message_numbers[message.id])
- is_read = defined?(@read_message_ids) && @read_message_ids[message.id]
- if user_signed_in?
- read_data = { controller: "read-status", "read-status-message-id-value": message.id, "read-status-read-url-value": read_message_path(message, format: :json), "read-status-delay-seconds-value": read_visibility_seconds }
- read_classes = ["message-content", ("is-read" if is_read)].compact
- else
- read_data = {}
- read_classes = ["message-content"]
.message-header
.message-author
.author-row
= link_to "##{display_number}", "#message-#{message.id}", class: "message-number"
= button_tag type: "button",
class: "message-copy",
data: { controller: "clipboard", action: "click->clipboard#copy", "clipboard-url-value": topic_url(@topic, anchor: "message-#{message.id}") },
title: "Copy message link",
"aria-label": "Copy message link" do
i.fa-regular.fa-copy
- display_alias = message.sender_display_alias
- profile_path = message.sender_person ? person_path(display_alias.email) : nil
- if profile_path
= link_to profile_path, class: "author-avatar-link" do
= image_tag display_alias.gravatar_url(size: 42), class: "message-avatar", alt: display_alias.name
- else
= image_tag display_alias.gravatar_url(size: 42), class: "message-avatar", alt: display_alias.name
.author-details
- if profile_path
.author-name = link_to display_alias.name, profile_path, class: "author-name-link"
- else
.author-name = display_alias.name
.author-email = display_alias.email
.message-meta
.message-date
time datetime=message.created_at.iso8601 title=absolute_time_display(message.created_at)
= time_ago_in_words(message.created_at)
| ago
- if message.reply_to
- parent_number = (@message_numbers && @message_numbers[message.reply_to.id]) || "-"
.reply-indicator
span.reply-to In reply to: #{message.reply_to.sender_display_alias.name} (##{parent_number})
- if message.attachments.any?
.attachment-indicator
span.attachment-count #{message.attachments.size} attachment(s)
- if message.message_id.present?
.message-archive-link
= link_to "https://postgr.es/m/#{ERB::Util.url_encode(message.message_id)}", target: "_blank", rel: "noopener", data: { turbo: false }, title: "View on postgr.es", "aria-label": "View on postgr.es" do
i.fa-solid.fa-building-columns
= link_to "https://www.postgresql.org/message-id/resend/#{ERB::Util.url_encode(message.message_id)}", target: "_blank", rel: "noopener", data: { turbo: false }, title: "Resend from postgresql.org archive", "aria-label": "Resend from postgresql.org archive" do
i.fa-solid.fa-paper-plane
.message-content class=read_classes.join(" ") data=read_data
- if message.subject != @topic.title && message.subject.present?
.message-subject = message.subject
.message-body
= render_message_body(message.body)
- if message.attachments.any?
.message-attachments id="message-#{message.id}-attachments"
h4 Attachments:
- message.attachments.each do |attachment|
- if attachment.patch?
details.attachment
summary.attachment-info
span.attachment-summary-row
span.filename = attachment.file_name
span.content-type = attachment.content_type if attachment.content_type
= link_to "Download", attachment_path(attachment), class: "attachment-download", download: attachment.file_name, data: { turbo: false }
- stats = attachment.diff_line_stats
- if stats[:added].positive? || stats[:removed].positive?
span.patchset-stats aria-label="Patch line changes" title="Lines added and removed by this patch"
span.patchset-added +#{stats[:added]}
span.patchset-removed -#{stats[:removed]}
pre.attachment-content
code.language-diff data-controller="diff-highlight"
= attachment.decoded_body_utf8
- else
.attachment
.attachment-info
span.filename = attachment.file_name
span.content-type = attachment.content_type if attachment.content_type
= link_to "Download", attachment_path(attachment), class: "attachment-download", download: attachment.file_name, data: { turbo: false }
- if message.import_log.present?
.import-metadata
details
summary Import Notes
pre.import-log = message.import_log
- notes_for_message = @notes_by_message&.[](message.id) || []
- if user_signed_in?
= render "notes/note_stack", topic: @topic, message: message, notes: notes_for_message