<div class="attachment-container step-asset" data-asset-id="<%= asset.id %>">
  <div class="attachment-preview <%= asset.file.attached? ? asset.file.metadata['asset_type'] : '' %>">
    <% if asset.previewable? %>
      <%= image_tag asset.medium_preview,
          onerror: 'ActiveStoragePreviews.reCheckPreview(event)',
          onload: 'ActiveStoragePreviews.showPreview(event)',
          style: 'opacity: 0' %>
    <% else %>
      <i class="fas <%= file_fa_icon_class(asset) if asset.file_name %>"></i>
    <% end %>
  </div>
  <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 %>
  </div>
  <div class="attachment-metadata">
    <%= t('assets.placeholder.modified_label') %> <%= l(asset.updated_at, format: :full_date) if asset.updated_at %><br>
    <%= number_to_human_size(asset.file_size) %>
  </div>
  <% unless asset.locked? %>
    <div class="remove-icon pull-right">
      <%= ff.remove_nested_fields_link do %>
        <span class="fas fa-trash"></span>
      <% end %>
    </div>
  <% end %>
</div>
