%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] ? [ 800, 600 ] : [ 1024, 768 ]) %figcaption.attachment__caption - if caption = blob.try(:caption) = caption - else %span.attachment__name= link_to blob.filename, blob %span.attachment__size= number_to_human_size blob.byte_size