You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

upload.js.erb 512B

1234567891011121314
  1. var fileSpan = $('#attachments_<%= j params[:attachment_id] %>');
  2. <% if @attachment.new_record? %>
  3. fileSpan.hide();
  4. alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>");
  5. <% else %>
  6. fileSpan.find('input.token').val('<%= j @attachment.token %>');
  7. fileSpan.find('a.remove-upload')
  8. .attr({
  9. "data-remote": true,
  10. "data-method": 'delete',
  11. href: '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>'
  12. })
  13. .off('click');
  14. <% end %>