scinote-web/app/views/reports/elements/_step_asset_element.html.erb
2019-07-09 10:28:15 +02:00

47 lines
1.9 KiB
Text

<% asset ||= @asset %>
<% is_image = asset.image? %>
<% timestamp = asset.created_at %>
<% icon_class = 'fas ' + (is_image ? 'fa-image' : 'fa-file') %>
<div class="report-element report-step-attachment-element report-step-asset-element" data-ts="<%= timestamp.to_i %>" data-type="step_asset" data-id='{ "asset_id": <%= asset.id %> }' data-scroll-id="<%= asset.id %>" data-name="<%=t "projects.reports.elements.step_asset.sidebar_name", file: asset.file_name %>" data-icon-class="<%= icon_class %>">
<div class="report-element-header">
<div class="row">
<div class="pull-left attachment-icon">
<span class="<%= icon_class %>"></span>
</div>
<div class="pull-left file-name">
<% if defined? export_all and export_all %>
<a href="<%= path %>">
<em><%=t 'projects.reports.elements.step_asset.file_name',
file: filename %></em>
</a>
<% else %>
<em><%=t 'projects.reports.elements.step_asset.file_name',
file: truncate(asset.file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></em>
<% end %>
</div>
<div class="pull-left user-time">
<%=t 'projects.reports.elements.step_asset.user_time', timestamp: l(timestamp, format: :full) %>
</div>
<div class="pull-right controls">
<%= render partial: 'reports/elements/element_controls.html.erb' %>
</div>
</div>
</div>
<div class="report-element-body">
<% if is_image %>
<div class="row">
<div class="col-xs-12 file-image">
<% if defined?(export_all) && export_all %>
<img class="report-export-img" src="<%= path %>">
<% else %>
<%= report_image_asset_url(asset) %>
<% end %>
</div>
</div>
<% end %>
</div>
<div class="report-element-children">
<%= children if (defined? children and children.present?) %>
</div>
</div>