Skip to content

Commit 62e6b53

Browse files
authored
Merge pull request #76 from dalvarez2596/lesson-119
Added option to download attachments
2 parents ece1310 + ad6d587 commit 62e6b53

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

app/views/active_storage/blobs/_blob.html.erb

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
%figure{class: "attachment attachment--#{blob.representable? ? "preview" : "file"} attachment--#{blob.filename.extension}"}
2+
- if blob.representable?
3+
= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ])
4+
%figcaption.attachment__caption
5+
- if caption = blob.try(:caption)
6+
= caption
7+
- else
8+
%span.attachment__name= blob.filename
9+
%span.attachment__size= number_to_human_size blob.byte_size
10+
= link_to rails_blob_path(blob, disposition: "preview"), target: :_blank do
11+
.fa.fa-download
12+
-# = link_to blob.filename, rails_blob_path(blob, disposition: "attachment"), target: :_blank
13+
14+
15+
16+
17+

0 commit comments

Comments
 (0)