To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / app / views / attachments / upload.js.erb @ 1591:63650ae64bf2

History | View | Annotate | Download (597 Bytes)

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
$('<input>', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
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 %>