annotate app/views/attachments/upload.js.erb @ 1628:9c5f8e24dadc live tip

Quieten this cron script
author Chris Cannam
date Tue, 25 Aug 2020 11:38:49 +0100
parents 261b3d9a4903
children
rev   line source
Chris@1464 1 var fileSpan = $('#attachments_<%= j params[:attachment_id] %>');
Chris@1464 2 <% if @attachment.new_record? %>
Chris@1464 3 fileSpan.hide();
Chris@1464 4 alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>");
Chris@1464 5 <% else %>
Chris@1464 6 $('<input>', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
Chris@1464 7 fileSpan.find('a.remove-upload')
Chris@1464 8 .attr({
Chris@1464 9 "data-remote": true,
Chris@1464 10 "data-method": 'delete',
Chris@1464 11 href: '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>'
Chris@1464 12 })
Chris@1464 13 .off('click');
Chris@1464 14 <% end %>