2019-04-27 18:46:45 +08:00
|
|
|
<div class="pseudo-attachment-container" style="order: <%= assets_count - i %>">
|
2019-04-27 04:59:38 +08:00
|
|
|
<%= link_to '',
|
|
|
|
class: 'file-preview-link',
|
2019-04-27 18:46:45 +08:00
|
|
|
id: "marvin_js_sketch_#{sketch.id}",
|
2019-04-27 04:59:38 +08:00
|
|
|
data: { no_turbolink: true, id: true, status: 'asset-present',
|
|
|
|
'preview-url': '',
|
2019-04-27 18:46:45 +08:00
|
|
|
'order-atoz': az_ordered_assets_index(step, sketch.id),
|
|
|
|
'order-ztoa': assets_count - az_ordered_assets_index(step, sketch.id),
|
|
|
|
'order-old': i,
|
|
|
|
'order-new': assets_count - i,
|
|
|
|
'asset-type': 'marvin-sketch',
|
|
|
|
'asset-id': sketch.id
|
2019-04-27 04:59:38 +08:00
|
|
|
} do %>
|
|
|
|
|
|
|
|
<div class="attachment-placeholder pull-left">
|
|
|
|
<div class="attachment-thumbnail">
|
|
|
|
<img src>
|
|
|
|
<%= hidden_field_tag :description, sketch.description %>
|
|
|
|
</div>
|
2019-04-27 18:46:45 +08:00
|
|
|
<div class="attachment-label"><%= truncate(sketch.name,
|
2019-04-27 04:59:38 +08:00
|
|
|
length: Constants::FILENAME_TRUNCATION_LENGTH) %></div>
|
|
|
|
<div class="spencer-bonnet-modif">
|
|
|
|
<%= t('protocols.steps.attachments.modified_label') %> <%= l(sketch.updated_at, format: :full_date) if sketch.updated_at %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2019-04-27 18:46:45 +08:00
|
|
|
<script>
|
|
|
|
(function(){
|
|
|
|
src=$('#marvin_js_sketch_<%= sketch.id %>').find('#description')
|
|
|
|
target=$('#marvin_js_sketch_<%= sketch.id %>').find('img')
|
|
|
|
MarvinJsEditor().create_preview(src,target)
|
|
|
|
})()
|
|
|
|
</script>
|
2019-04-27 04:59:38 +08:00
|
|
|
</div>
|