<div id="documents">
  <%= render :partial => 'index', :locals => {:grouped => @grouped} -%>
</div>


<% ### PAGE CUSTOMS ########################################################## %>

<% content_for :easy_page_layout_service_box do %>
  <% if User.current.allowed_to?(:add_documents, @project) %>
      <%= link_to( l(:label_document_new), new_project_document_path(:project_id => @project), :class => 'button-positive icon icon-add') -%>
  <% end %>
<% end %>

<% html_title(l(:label_document_plural)) -%>

<% content_for :sidebar do %>
  <div class="box">
    <%= toggling_container('query_sort', User.current, {:heading => l(:label_sort_by, ''), :wrapping_heading_element_classes => 'icon icon-document'}) do %>
      <%= form_tag({:controller => 'documents', :action => 'index', :project_id => @project}, :method => :get) do %>
        <div class="order">
          <label><%= radio_button_tag 'sort_by', 'category', (@sort_by == 'category'), :onclick => 'this.form.submit();' %> <%= l(:field_category) %></label>
          <label><%= radio_button_tag 'sort_by', 'date', (@sort_by == 'date'), :onclick => 'this.form.submit();' %> <%= l(:label_date) %></label>
          <label><%= radio_button_tag 'sort_by', 'title', (@sort_by == 'title'), :onclick => 'this.form.submit();' %> <%= l(:field_title) %></label>
          <label><%= radio_button_tag 'sort_by', 'author', (@sort_by == 'author'), :onclick => 'this.form.submit();' %> <%= l(:field_author) %></label>
        </div>
      <% end %>
    <% end %>
  </div>
<% end %>

<% include_attachment_tags %>
