scinote-web/app/views/shared/_asset_link.html.erb
2018-04-26 17:00:51 +02:00

22 lines
841 B
Plaintext

<% if asset.file_present %>
<% if asset.file.processing? && display_image_tag && asset.is_image? %>
<span data-status='asset-loading'
data-present-url='<%= file_present_asset_path(asset.id) %>'>
<%= image_tag 'medium/processing.gif' %>
</span>
<% else %>
<%= link_to download_asset_path(asset),
class: 'file-preview-link',
id: "modal_link#{asset.id}",
data: { no_turbolink: true, id: true, status: 'asset-present', 'preview-url': asset_file_preview_path(asset) } do %>
<% if asset.is_image? && display_image_tag %>
<%= image_tag asset.url(:medium) %>
<% end %>
<p><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
<% end %>
<% end %>
<% else %>
<%= image_tag 'medium/processing.gif' %>
<% end %>