Skip to content
Snippets Groups Projects
_blob.html.erb 757 B
Newer Older
<figure class="attachment attachment--<%= blob.variable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
  <% if blob.image? %>
Sébastien Gaya's avatar
Sébastien Gaya committed
    <%= kamifusen_tag blob, width: 800 %>
  <% elsif blob.video? %>
    <video controls>
      <source src="<%= rails_blob_path(blob) %>" type="<%= blob.content_type %>">
    </video>
Sébastien Gaya's avatar
Sébastien Gaya committed
  <% else %>
Sébastien Gaya's avatar
Sébastien Gaya committed
    <%= link_to polymorphic_path(blob), target: :blank do %>
      <p>
        <span class="attachment__name"><%= blob.filename %></span>
        <span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
      </p>
    <% end %>
Sébastien Gaya's avatar
Sébastien Gaya committed
  <% end %>

Sébastien Gaya's avatar
Sébastien Gaya committed
  <% if caption = blob.try(:caption) %>
    <figcaption class="attachment__caption">
Sébastien Gaya's avatar
Sébastien Gaya committed
      <%= caption %>
Sébastien Gaya's avatar
Sébastien Gaya committed
    </figcaption>
  <% end %>
Sébastien Gaya's avatar
Sébastien Gaya committed
</figure>