<div class="contextual">
<% if User.current.allowed_to?(:edit_documents, @project) %>
<%= link_to sprite_icon('edit', l(:button_edit)), edit_document_path(@document), :class => 'icon icon-edit', :accesskey => accesskey(:edit) %>
<% end %>
<% if User.current.allowed_to?(:delete_documents, @project) %>
<%= delete_link document_path(@document) %>
<% end %>
</div>

<h2><%= @document.title %></h2>

<p><em><%= @document.category.name %><br />
<%= format_date @document.created_on %></em></p>

<% if @document.custom_field_values.any? %>
<ul>
  <% render_custom_field_values(@document) do |custom_field, formatted| %>
    <li><span class="label"><%= custom_field.name %>:</span> <%= formatted %></li>
  <% end %>
</ul>
<% end %>

<div class="wiki">
<%= textilizable @document, :description, :attachments => @document.attachments %>
</div>

<h3><%= l(:label_attachment_plural) %></h3>
<%= link_to_attachments @document, :thumbnails => true %>

<% if authorize_for('documents', 'add_attachment') %>
<p><%= link_to l(:label_attachment_new), {}, :onclick => "$('#add_attachment_form').show(); return false;",
                                             :id => 'attach_files_link' %></p>
  <%= form_tag({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %>
  <div class="box">
  <p><%= render :partial => 'attachments/form' %></p>
  </div>
  <%= submit_tag l(:button_add) %>
  <% end %>
<% end %>

<% html_title @document.title -%>
