<%= link_to sprite_icon('add', l(:label_document_new)), new_project_document_path(@project), :class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-document", "document_title"); return false;' if User.current.allowed_to?(:add_documents, @project) %>
<%=l(:label_document_new)%>
<%= labelled_form_for @document, :url => project_documents_path(@project), :html => {:multipart => true} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_create) %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-document").hide(); return false;' %>
<% end %>
<%=l(:label_document_plural)%>
<% if @grouped.empty? %>
<%= l(:label_no_data) %>
<% end %>
<% @grouped.keys.sort.__send__(@sort_by == 'date' ? :reverse_each : :each) do |group| %>
<%= group %>
<%= render :partial => 'documents/document', :collection => @grouped[group] %>
<% end %>
<% content_for :sidebar do %>
<%= l(:label_sort_by, '') %>
- <%= link_to(l(:field_category), {:sort_by => 'category'},
:class => (@sort_by == 'category' ? 'selected' :nil)) %>
- <%= link_to(l(:label_date), {:sort_by => 'date'},
:class => (@sort_by == 'date' ? 'selected' :nil)) %>
- <%= link_to(l(:field_title), {:sort_by => 'title'},
:class => (@sort_by == 'title' ? 'selected' :nil)) %>
- <%= link_to(l(:field_author), {:sort_by => 'author'},
:class => (@sort_by == 'author' ? 'selected' :nil)) %>
<% end %>
<% html_title(l(:label_document_plural)) -%>