upload.js.erb
14 lines
| 512 B
| text/plain
|
TextLexer
|
r10748 | var fileSpan = $('#attachments_<%= j params[:attachment_id] %>'); | ||
|
r11612 | <% if @attachment.new_record? %> | ||
fileSpan.hide(); | ||||
alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>"); | ||||
<% else %> | ||||
|
r15535 | fileSpan.find('input.token').val('<%= j @attachment.token %>'); | ||
|
r10748 | fileSpan.find('a.remove-upload') | ||
.attr({ | ||||
"data-remote": true, | ||||
"data-method": 'delete', | ||||
href: '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' | ||||
}) | ||||
.off('click'); | ||||
|
r11612 | <% end %> | ||