isprambiente/Domando

View on GitHub
app/views/active_storage/blobs/_blob.html.haml

Summary

Maintainability
Test Coverage
-#
  %figure{class: "attachment attachment--#{blob.representable? ? "preview" : "file"} attachment--#{blob.filename.extension}"}
    - if blob.representable?
      = image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 100, 100 ] : [ 200, 200 ])
      %figcaption.attachment__caption
        - if caption = blob.try(:caption)
          = caption
        - else
          %span.attachment__name= blob.filename
          %span.attachment__size= number_to_human_size blob.byte_size
    - else
      %a{ href: rails_blob_path(blob), download: true, download: blob.filename, target: "_blank" }= blob.filename
  %br
%a.button.is-ghost{ href: rails_blob_path(blob), download: true, download: blob.filename, target: "_blank" }= blob.filename
%br