diff options
author | Javan Makhmali <javan@javan.us> | 2018-10-03 14:41:47 -0400 |
---|---|---|
committer | Javan Makhmali <javan@javan.us> | 2018-10-03 14:41:47 -0400 |
commit | 30443121286c3bb970d4d24bf7f24472498e9633 (patch) | |
tree | 6799fe7cc8aaabd6bfa35c8dfc75a11eb7f4e332 /app/views/active_storage/blobs | |
parent | 7a993324342d5542dcb40902eed097f7eaac3f1b (diff) | |
download | rails-30443121286c3bb970d4d24bf7f24472498e9633.tar.gz rails-30443121286c3bb970d4d24bf7f24472498e9633.tar.bz2 rails-30443121286c3bb970d4d24bf7f24472498e9633.zip |
Move attachment rendering to a helper
Fixes #5
Diffstat (limited to 'app/views/active_storage/blobs')
-rw-r--r-- | app/views/active_storage/blobs/_blob.html.erb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/views/active_storage/blobs/_blob.html.erb b/app/views/active_storage/blobs/_blob.html.erb index c7c70c110e..6e4105d5cf 100644 --- a/app/views/active_storage/blobs/_blob.html.erb +++ b/app/views/active_storage/blobs/_blob.html.erb @@ -1,8 +1,9 @@ +<% transformations = { resize: local_assigns[:in_gallery] ? "800x600>" : "1024x768>" } %> <figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>"> <% if blob.variable? %> - <%= image_tag blob.variant(resize: "1024x768>") %> + <%= image_tag blob.variant(transformations) %> <% elsif blob.previewable? %> - <%= image_tag blob.preview(resize: "1024x768>") %> + <%= image_tag blob.preview(transformations) %> <% end %> <figcaption class="attachment__caption"> |