<% result ||= report_element.result %>
<% result.assets.each do |asset| %>
  <% timestamp = asset.created_at %>
  <div class="report-element report-result-element report-result-asset-element">
    <div class="report-element-header">
      <span class="result-icon">
        <%= file_extension_icon_html(asset, true) %>
      </span>
      <span class="result-name">
        <%= result.name.presence || I18n.t('projects.reports.unnamed') %>
        <% if result.archived? %>
          <span class="label label-warning"><%= t('search.index.archived') %></span>
        <% end %>
      </span>
      <div class="file-name">
        <% if defined? export_all and export_all %>
          <% file_link = @obj_filenames.dig(:assets, asset.id, :file) %>
          <a href="<%= file_link %>" class="export-all-link" >
            <em><%= file_link&.split('/')&.last %></em>
          </a>
        <% else %>
          <em>
            <%= truncate(asset.file_name, length: Constants::FILENAME_TRUNCATION_LENGTH) %>
            <%= link_to t('projects.reports.elements.download'), asset_download_url(asset, disposition: 'attachment'), class: 'download-link', target: :_blank %>
          </em>
        <% end %>
      </div>  
      <div class="user-time">
        <% unless @settings['exclude_timestamps'] %>
          <%= t("projects.reports.elements.result_asset.user_time", user: result.user.full_name, timestamp: l(timestamp, format: :full)) %>
        <% end %>
        <% if report.settings.dig(:task, :file_results_previews) && ActiveStorageFileUtil.previewable_document?(asset&.file&.blob) %>
          <%= t('projects.reports.elements.result_asset.full_preview_attached') %>
        <% end %>
      </div>
    </div>
    <% if asset.previewable? && !asset.list? %>
      <div class="report-element-body">
        <div class="file-image">
          <% if defined?(export_all) && export_all %>
            <img class="report-export-img" src="<%= @obj_filenames.dig(:assets, asset.id, :preview) %>">
          <% else %>
            <%= report_image_asset_url(asset) %>
          <% end %>
        </div>
      </div>
    <% end %>
    <% if defined?(children) %>
      <div class="report-element-children">
        <%= children %>
      </div>
    <% end %>
  </div>
<% end %>
