Skip to content

Commit 9b64945

Browse files
committed
Add attached patches to message view
Also let the user expand/collapse them by clicking.
1 parent 67a4c9e commit 9b64945

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

app/assets/stylesheets/components/messages.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,18 +224,24 @@
224224

225225
.attachment-info {
226226
display: flex;
227-
gap: var(--spacing-3);
228227
align-items: center;
228+
cursor: pointer;
229229
font-size: var(--font-size-sm);
230230
}
231231

232+
summary.attachment-info {
233+
display: list-item;
234+
cursor: pointer;
235+
}
236+
232237
.filename {
233238
font-weight: var(--font-weight-medium);
234239
color: var(--color-text-primary);
235240
}
236241

237242
.content-type {
238243
color: var(--color-text-muted);
244+
margin-left: var(--spacing-3);
239245
}
240246

241247
.import-metadata {

app/views/topics/_message.html.slim

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,19 @@
4141
.message-attachments
4242
h4 Attachments:
4343
- message.attachments.each do |attachment|
44-
.attachment
45-
.attachment-info
46-
span.filename = attachment.file_name
47-
span.content-type = attachment.content_type if attachment.content_type
44+
- if attachment.patch?
45+
details class="attachment"
46+
summary class="attachment-info"
47+
span.filename = attachment.file_name
48+
span.content-type = attachment.content_type if attachment.content_type
49+
pre class="attachment-content"
50+
code class="language-patch"
51+
= attachment.decoded_body
52+
- else
53+
.attachment
54+
.attachment-info
55+
span.filename = attachment.file_name
56+
span.content-type = attachment.content_type if attachment.content_type
4857

4958
- if message.import_log.present?
5059
.import-metadata

0 commit comments

Comments
 (0)