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

38 lines
1.4 KiB
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' %>
2018-05-10 16:37:48 +08:00
<%= 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 %>
<span><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></span>
2018-05-10 16:37:48 +08:00
<% end %>
2018-03-30 17:50:28 +08:00
</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 %>
<% if display_image_tag %>
<p>
<%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %>
</p>
<% else %>
<span>
<%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %>
</span>
<% end %>
2018-03-30 17:50:28 +08:00
<% end %>
<% end %>
<% else %>
<%= image_tag 'medium/processing.gif' %>
<% end %>