summaryrefslogtreecommitdiffstats
path: root/app/views/documents/show.rhtml
blob: 599ac389b12f5eef3ea29f98078f7c32b8de573e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<div class="contextual">
<%= link_to_if_authorized l(:button_edit), {:controller => 'documents', :action => 'edit', :id => @document}, :class => 'icon icon-edit', :accesskey => accesskey(:edit) %>
<%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy', :id => @document}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
</div>

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

<p><em><%=h @document.category.name %><br />
<%= format_date @document.created_on %></em></p>
<%= textilizable @document.description, :attachments => @document.attachments %>
<br />

<h3><%= l(:label_attachment_plural) %></h3>
<ul class="documents">  
<% for attachment in @attachments %>
    <li>
        <div class="contextual">
        <%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy_attachment', :id => @document, :attachment_id => attachment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
        </div>
        <%= link_to attachment.filename, :action => 'download', :id => @document, :attachment_id => attachment %>
        (<%= number_to_human_size attachment.filesize %>)<br />
        <span class="author"><%= authoring attachment.created_on, attachment.author %></span><br />
        <%= lwr(:label_download, attachment.downloads) %>
    </li>
<% end %>
</ul>
<br />


<% if authorize_for('documents', 'add_attachment') %>
<p><%= toggle_link l(:label_attachment_new), "add_attachment_form" %></p>
  <% form_tag({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true, :class => "tabular", :id => "add_attachment_form", :style => "display:none;") do %>
    <%= render :partial => 'attachments/form' %>
  <%= submit_tag l(:button_add) %>
  <% end %> 
<% end %>

<% html_title @document.title -%>