@@ -1,4 +1,8 | |||
|
1 | 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 %> | |
|
2 | 6 | $('<input>', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); |
|
3 | 7 | fileSpan.find('a.remove-upload') |
|
4 | 8 | .attr({ |
@@ -7,3 +11,4 fileSpan.find('a.remove-upload') | |||
|
7 | 11 | href: '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' |
|
8 | 12 | }) |
|
9 | 13 | .off('click'); |
|
14 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now