- if Document.count > 20
  = items_per_page
= pagination_links_remote @documents
%table.table.table-striped
  %thead
    %tr
      %th= sort_link_helper heading_helper(Document, :name), "name", :per_page => @per_page
      %th= sort_link_helper heading_helper(Document, :created_at), "created_at", :per_page => @per_page
      %th= heading_helper(Document, :created_by)
      %th
  %tbody
    - for document in @documents
      %tr
        %td= link_to document.name, document, class: "documents-item-#{document.folder? ? 'folder' : 'file'}"
        %td= format_time(document.created_at)
        %td= h show_user(document.created_by)
        %td
          - if document.created_by == current_user or current_user.role_admin?
            = link_to t('ui.move'), document_move_path(document), remote: true, class: 'btn btn-mini'
            = link_to t('ui.delete'), document, :method => :delete, :data => {:confirm => t('ui.confirm_delete', name: document.name)},
            class: 'btn btn-mini btn-danger'
