scinote-web/app/views/assets/marvinjs/_marvin_sketch_card.html.erb

34 lines
1.5 KiB
Text
Raw Normal View History

<div class="pseudo-attachment-container" style="order: <%= assets_count - i %>">
2019-04-27 04:59:38 +08:00
<%= link_to '',
class: 'file-preview-link',
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': '',
'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>
<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 %>
<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>