annotate app/views/attachments/upload.js.erb @ 1464:261b3d9a4903 redmine-2.4

Update to Redmine 2.4 branch rev 12663
author Chris Cannam
date Tue, 14 Jan 2014 14:37:42 +0000
parents
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 %>