chris@22
|
1 <div class="contextual">
|
chris@37
|
2 <%= link_to(l(:label_attachment_new), new_project_file_path(@project), :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
|
chris@22
|
3 </div>
|
chris@22
|
4
|
chris@22
|
5 <h2><%=l(:label_attachment_plural)%></h2>
|
chris@22
|
6
|
chris@22
|
7 <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
chris@255
|
8 <% active_change_allowed = delete_allowed %>
|
chris@22
|
9
|
chris@22
|
10 <table class="list files">
|
chris@22
|
11 <thead><tr>
|
chris@256
|
12 <%= sort_header_tag('active', :caption => l(:field_active)) %>
|
chris@22
|
13 <%= sort_header_tag('filename', :caption => l(:field_filename)) %>
|
chris@22
|
14 <%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc') %>
|
chris@22
|
15 <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc') %>
|
chris@255
|
16 <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc') %>
|
chris@22
|
17 <th>MD5</th>
|
chris@22
|
18 <th></th>
|
chris@22
|
19 </tr></thead>
|
chris@22
|
20 <tbody>
|
chris@260
|
21 <% have_file = false %>
|
Chris@909
|
22 <% @containers.each do |container| %>
|
chris@22
|
23 <% next if container.attachments.empty? -%>
|
Chris@909
|
24 <% if container.is_a?(Version) -%>
|
chris@22
|
25 <tr>
|
Chris@1484
|
26 <th colspan="7">
|
Chris@909
|
27 <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package") %>
|
Chris@909
|
28 </th>
|
Chris@909
|
29 </tr>
|
Chris@909
|
30 <% end -%>
|
Chris@909
|
31 <% container.attachments.each do |file| %>
|
chris@269
|
32 <tr class="file <%= cycle("odd", "even") %> <%= "active" if file.active? %>">
|
chris@257
|
33 <td class="active">
|
chris@260
|
34 <% have_file = true %>
|
chris@257
|
35 <% if active_change_allowed
|
chris@257
|
36 active_id = "active-" + file.id.to_s -%>
|
chris@257
|
37 <div id="<%= active_id %>">
|
chris@1154
|
38 <%= link_to image_tag(file.active? ? 'fav.png' : 'fav_off.png'),
|
chris@1154
|
39 {:controller => 'attachments', :action => 'toggle_active', :project_id => @project.id, :id => file},
|
chris@1154
|
40 :remote => true
|
chris@257
|
41 %>
|
chris@257
|
42 </div>
|
chris@257
|
43 <% else -%>
|
chris@257
|
44 <%= image_tag('fav.png') if file.active? %>
|
chris@257
|
45 <% end -%>
|
chris@257
|
46 </td>
|
chris@269
|
47 <% if file.active? %>
|
chris@269
|
48 <td class="filename active"><%= link_to_attachment file, :download => true %><br><span class="description"><%= h(file.description) %></span></td>
|
chris@269
|
49 <% else %>
|
chris@269
|
50 <td class="filename"><%= link_to_attachment file, :download => true, :title => file.description %>
|
chris@269
|
51 <% end %>
|
chris@269
|
52 </td>
|
chris@22
|
53 <td class="created_on"><%= format_time(file.created_on) %></td>
|
chris@22
|
54 <td class="filesize"><%= number_to_human_size(file.filesize) %></td>
|
chris@22
|
55 <td class="downloads"><%= file.downloads %></td>
|
chris@22
|
56 <td class="digest"><%= file.digest %></td>
|
Chris@1464
|
57 <td class="buttons">
|
Chris@909
|
58 <%= link_to(image_tag('delete.png'), attachment_path(file),
|
Chris@1115
|
59 :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
|
chris@22
|
60 </td>
|
Chris@909
|
61 </tr>
|
chris@22
|
62 <% end
|
chris@22
|
63 reset_cycle %>
|
chris@22
|
64 <% end %>
|
chris@22
|
65 </tbody>
|
chris@22
|
66 </table>
|
chris@22
|
67
|
chris@1154
|
68 <%= l(:text_files_active_change).html_safe if active_change_allowed and have_file %>
|
chris@257
|
69
|
chris@22
|
70 <% html_title(l(:label_attachment_plural)) -%>
|