Created
June 1, 2015 12:50
-
-
Save fabrinal/683f9c7dd9b6261ca456 to your computer and use it in GitHub Desktop.
Add one link to delete photo using ajax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="field"> | |
<%= f.label 'Photos' %><br> | |
<% 10.times do |i| %> | |
Photo <%= i + 1 %> | |
<%= file_field_tag "photos[#{i}]", accept: 'image/png,image/jpeg' %> | |
<%= @photo_gallery.photos[i].nil? ? '' : label_tag(@photo_gallery.photos[i].image_file_name,nil,id: "photo#{@photo_gallery.photos[i].id}") %> | |
<!-- add link to delete single photo object below --> | |
<%= @photo_gallery.photos[i].nil? ? '' : link_to('Hapus Foto',@photo_gallery.photos[i],remote: true, method: :delete,:class => "delete_photo", data: {value: @photo_gallery.photos[i].id}) %><br><br> | |
<% end %> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment