bigdir/app/views/files/index.html.erb

60 lines
2.6 KiB
Plaintext
Raw Normal View History

2013-09-13 22:25:31 +08:00
<% if @project.project_type == 1 %>
<div class="contextual" style="padding-right: 540px;padding-top: 5px;">
2013-09-23 09:32:04 +08:00
<% if User.current.member_of?(@project) %>
<%= link_to(l(:label_file_upload), new_project_file_path(@project), :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
<% end %>
2013-08-01 10:33:49 +08:00
</div>
2013-09-13 22:25:31 +08:00
<% else %>
<div class="contextual" style="padding-right: 540px;padding-top: 5px;">
<!-- %= link_to(l(:label_attachment_new), new_project_file_path(@project), :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) % -->
<%= link_to(l(:label_attachment_new), new_project_file_path(@project), :class => 'icon icon-add') if User.current.member_of?(@project) %>
2013-09-13 22:25:31 +08:00
</div>
<% end %>
2013-08-01 10:33:49 +08:00
<h3><%=l(:label_attachment_plural)%></h3>
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<table class="list files">
<thead><tr>
<%= sort_header_tag('filename', :caption => l(:field_filename)) %>
<%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc') %>
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc') %>
2013-09-13 22:25:31 +08:00
<!-- <%= sort_header_tag('downloads', :caption => l(:label_downloads_abbr), :default_order => 'desc') %> -->
2013-09-16 08:49:39 +08:00
<th> <%= sort_header_tag('description', :caption => l(:field_description)) %></th>
2013-08-01 10:33:49 +08:00
<th></th>
</tr></thead>
<tbody>
<% @containers.each do |container| %>
<% next if container.attachments.empty? -%>
<% if container.is_a?(Version) -%>
<tr>
<th colspan="6" align="left">
<%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package") %>
</th>
</tr>
<% end -%>
<% container.attachments.each do |file| %>
<tr class="file <%= cycle("odd", "even") %>">
<td class="filename"><%= link_to_attachment file, :download => true, :title => file.description %></td>
<td class="created_on"><%= format_time(file.created_on) %></td>
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
<!-- <td class="downloads"><%= file.downloads %></td> -->
<td class="digest" width="300px"><%= file.description %></td>
<td align="center">
<%= link_to(image_tag('delete.png'), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
</td>
</tr>
<% end %>
<% reset_cycle %>
<% end %>
<!-- %= h downloadAll(@containers) % -->
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
2013-08-01 10:33:49 +08:00
</tbody>
</table>
<% html_title(l(:label_attachment_plural)) -%>
2013-09-23 09:32:04 +08:00