<%% title “<%=child_plural_class_name%>” %>

<%%= stylesheet( ‘dust_<%=parent_singular_name%>’,‘<%=parent_singular_name%>_uploadify’) %> <%%= javascript( ‘uploadify/jquery.uploadify.v2.1.0’ ) %>

<script type=“text/javascript” charset=“utf-8”>

$(document).ready(function() {
  $(function () { // this line makes sure this code runs on page load
    $('.checkall').click(function () {
      $(this).parents('form:eq(0)').find(':checkbox').attr('checked', this.checked);
    });
  });
});

</script>

<div class=“button_bar”>

<%%= render :partial => 'search' %>

</div>

<%%= will_paginate @<%=child_plural_name%> %>

<%% @<%=child_singular_name%>_<%=parent_plural_name%>.sort.each do |title, <%=child_plural_name%>| %>

<div class='<%=child_singular_name%>list'>
  <h1><%%= link_to title, <%=parent_singular_name%>_path(<%=child_plural_name%>.first.<%=parent_singular_name%>) %></h1>

  <%% form_for :<%=child_singular_name%>, :url => {:action => 'destroy'} do %>

  <table class='<%=child_plural_name%>'>
    <tr style='color:#222;'>
      <th>

      </th>
      <th></th>
      <th>
        File Name
      </th>
      <th>
        File Size
      </th>
      <th>
        Created At
      </th>
    </tr>
  <%% for <%=child_singular_name%> in <%=child_plural_name%> %>
  <%%= hidden_field_tag :<%=parent_singular_name%>_id, <%=child_singular_name%>.<%=parent_singular_name%>.id %>
  <tr class='<%%= cycle('odd', 'even')%>'>
    <td>
      <%%= check_box_tag "<%=child_singular_name%>_ids[]", <%=child_singular_name%>.id %>
    </td>
    <td>
      <%%= link_to image_tag(<%=child_singular_name%>.file.url(:thumb), :height => "30"), <%=child_singular_name%>.file.url(:original), :rel => title, :id => 'single_image' %>

        <div style="display:none"><div id="<%%=<%=child_singular_name%>.id%>"><%%= image_tag(<%=child_singular_name%>.file.url(:original)) %></div></div>
    </td>
    <td>
      <%%= <%=child_singular_name%>.file_file_name %>
    </td>
    <td>
      <%%= number_to_human_size(<%=child_singular_name%>.file_file_size) %>
    </td>
    <td>
      <%%= <%=child_singular_name%>.created_at.to_s(:m_d_y) %>
    </td>
  </tr>
  <%% end %>
  <tr class='odd'>
    <td colspan='5'>
      <input type="checkbox" class="checkall"> Check all
      <%%= submit_tag "Delete checked" %>
    </td>
  </tr>
  </table>

  <%% end -%>

</div>

<%% end %>

<%%= will_paginate @<%=child_plural_name%> %>