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