I am working on an app that have this code on a view file
<%= form_for @car, :html => { :method => :put }, :html => { :multipart => true } do |f| %>
<h3 id="photos_count"><%= pluralize(@car.uploads.size, "Photo")%></h3>
<div style="margin:10px 0 50px 0;float:left;width:700px;">
<%= f.submit "Delete selected photos" %>
</div>
<div style="width:500px !important;">
<%= f.fields_for :uploads do |photo_fields| %>
<%unless photo_fields.object.new_record? %>
<div style="width:150px;float:left;">
<%= image_tag(photo_fields.object.photo.url(:thumb)) %>
<p><%= photo_fields.check_box :_destroy %> Delete item</p>
</div>
<% end %>
<% end %>
</div>
<% end %>
that generates a form with photos for cars that I can select one by one and then press Delete selected photo to delete them.
I need a select all check box or link at least.
I’ve google it and found solutions on how to do it, the reason why I can’t test it is cause I am way too far from the working machine and I got the mail from the client to solve this asap.
I could not get how this things work.
I am online with the staff members from the server where the app is running and I just need the solution to give them.
the form generated by this code:
http://pastie.org/3013008
P.S. again, I would try to do this on my own but I am not on my working machine and I am on Windows platform on this one.
To select a checkbox via jquery, you change the checked property
That will check all the input of type checkbox.
Depending on your situation, you might wanna change the selector
Now all u have to do is to bind this code to a link or a checkbox.