scinote-web/app/views/shared/_asset_link.html.erb

22 lines
841 B
Plaintext
Raw Normal View History

2018-03-30 17:50:28 +08:00
<% if asset.file_present %>
2018-04-26 23:00:51 +08:00
<% if asset.file.processing? && display_image_tag && asset.is_image? %>
2018-03-30 17:50:28 +08:00
<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 %>
2018-03-30 17:50:28 +08:00
<%= 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 %>