scinote-web/app/views/assets/marvinjs/_marvin_sketch_card_placeholder.html.erb
2019-04-27 13:51:35 +02:00

32 lines
No EOL
1.5 KiB
Text

<div class="attachment-placeholder pull-left" data-marvinjs-sketch="<%= sketch.id %>">
<div class="attachment-thumbnail">
<img src>
<%= hidden_field_tag :description, sketch.description %>
</div>
<script>
(function(){
src=$('.attachment-placeholder[data-marvinjs-sketch="<%= sketch.id %>"]').find('#description')
target=$('.attachment-placeholder[data-marvinjs-sketch="<%= sketch.id %>"]').find('img')
MarvinJsEditor().create_preview(src,target)
})()
</script>
<div class="attachment-label"><%= truncate(sketch.name,
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>
<% if edit_page %>
<div class="remove-icon pull-right">
<span class="fas fa-trash"></span>
</div>
<script>
$('.attachment-placeholder[data-marvinjs-sketch="<%= sketch.id %>"]').find('.remove-icon')
.click(function() {
MarvinJsEditor().delete_sketch(
'<%= marvin_js_asset_path(sketch.id) %>',
'.attachment-placeholder[data-marvinjs-sketch="<%= sketch.id %>"]'
)
})
</script>
<% end %>
</div>