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

35 lines
1.4 KiB
Plaintext
Raw Normal View History

2019-04-09 18:28:42 +08:00
<div class="attachment-placeholder pull-left">
<div class="attachment-thumbnail <%= asset.previewable? ? '' : 'no-shadow' %> <%= asset.file.attached? ? asset.file.metadata['asset_type'] : '' %>">
2019-06-28 14:17:09 +08:00
<% if asset.previewable? %>
<%= image_tag asset.medium_preview,
onerror: 'ActiveStoragePreviews.reCheckPreview(event)',
onload: 'ActiveStoragePreviews.showPreview(event)',
style: 'opacity: 0' %>
2019-04-09 18:28:42 +08:00
<% else %>
2019-06-28 14:17:09 +08:00
<i class="fas <%= file_fa_icon_class(asset) if asset.file_name %>"></i>
2019-04-09 18:28:42 +08:00
<% end %>
</div>
2019-06-28 14:17:09 +08:00
<div class="attachment-label">
<% if asset.file.attached? && asset&.file&.metadata['asset_type'] %>
<%= truncate(asset.file.metadata['name'], length: Constants::FILENAME_TRUNCATION_LENGTH) %>
<% else %>
<%= truncate(asset.file_name, length: Constants::FILENAME_TRUNCATION_LENGTH) %>
<% end %>
2019-06-28 14:17:09 +08:00
</div>
2019-04-09 18:28:42 +08:00
<div class="spencer-bonnet-modif">
<%= t('assets.placeholder.modified_label') %> <%= l(asset.updated_at, format: :full_date) if asset.updated_at %> <br>
2019-06-28 14:17:09 +08:00
<%= number_to_human_size(asset.file_size) %>
2016-02-12 23:52:43 +08:00
</div>
2019-04-23 19:35:10 +08:00
<% if edit_page %>
<div class="remove-icon pull-right">
2019-06-28 14:17:09 +08:00
<% unless ff.object.file.attached? && ff.object.locked? %>
2019-04-23 19:35:10 +08:00
<%= ff.remove_nested_fields_link do %>
<span class="fas fa-trash"></span>
<% end %>
2019-04-09 18:28:42 +08:00
<% end %>
2019-04-23 19:35:10 +08:00
</div>
<% end %>
2016-10-02 00:47:05 +08:00
</div>