added pagination gem, many fixes
[smr.git] / gui / app / views / documents / index.html.erb
bloba7edfae109d1924182ed1cd7038194ed620fc6d3
1 <h1>Documents</h1>
3 <%= form_tag({:action=>'create'}, :multipart=>true) do %>
4     <fieldset id='document'>
5       <legend>Add Document</legend>
6         <p>
7         <%= file_field :document, :content %><br/>
8         <%= text_field_tag 'document[comment]', nil, placeholder: 'Comment' %><br/>
9         <%= select_tag 'id_portfolio', options_from_collection_for_select(@portfolios, 'id', 'name'), prompt: '-- Link to Portfolio --' %><br/>
10         </p>
11         <%= submit_tag 'Store Document' %>
12     </fieldset>
13 <% end %>
15 <table>
16     <thead>
17     <tr>
18         <th><%= paginate @documents %></th>
19         <th>Uploaded</th>
20         <th>Filename</th>
21         <th>Comment / Relations</th>
22     </tr>
23     </thead>
24     <tbody>
25     <% @documents.each do |d| %>
26     <tr>
27         <td><%= link_to 'delete', controller: 'documents', action: 'delete_document', id: d.id  if d.time_upload > 5.days.ago %></td>
28         <td><%= smr_humanize d.time_upload %></td>
29         <td><%= link_to d.filename, :id=>d.id, :action=>'download' %><em><%= number_to_human_size(d.size, :precision=>2) %></em></td>
30         <td><%= d.comment %>
31             <em><%= d.relations_text %></em>
32         </td>
33     </tr>
34     <% end %> 
35     </tbody>
36 </table>