mercredi 4 mai 2016

Display Records if Checkbox is selected

I am creating a simple form that has Some records and a checkbox on it. Now, when i select the checkbox the first two records should hide.

This is my Controller:

def galleryhome
   @gallery_photos = GalleryPhoto.where(gallery_id: params[:id])
end

This is my view:

<div class="checkbox">
    <input type="checkbox" name="remember" id="HideRecord">
    <label for="remember" class="optional">Hide photos in albums</label>
  </div>
</div>
<div class="all-photo"> <!--start-photo-view-->
  <%= hidden_field_tag "Value"%>
  <% @gallery_photos.each do |gallery_photo| %>
  <ul class="photos-view">
    <li class="photo-tile">
      <div class="inside-img"><%= image_tag gallery_photo.photo.url%></div>
      <div class="inside-img-open">
        <a  data-target="#viewlarge-Img" data-toggle="modal" href="#" class="fa fa-search" ></a>
      </div>
      <div class="photo-name"><%= gallery_photo.photo_file_name%></div>
    </li>
  </ul>
  <% end %>
</div>

Can anyone please help me?




Aucun commentaire:

Enregistrer un commentaire