view app/views/files/index.html.erb @ 1628:9c5f8e24dadc live tip

Quieten this cron script
author Chris Cannam
date Tue, 25 Aug 2020 11:38:49 +0100
parents 51364c0cd58f
children
line wrap: on
line source
<div class="contextual">
<%= link_to(l(:label_attachment_new), new_project_file_path(@project), :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
</div>

<h2><%=l(:label_attachment_plural)%></h2>

<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<% active_change_allowed = delete_allowed %>

<table class="list files">
  <thead><tr>
    <%= sort_header_tag('active', :caption => l(:field_active)) %>
    <%= 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') %>
    <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc') %>
    <th>MD5</th>
    <th></th>
  </tr></thead>
  <tbody>
<% have_file = false %>
<% @containers.each do |container| %>
  <% next if container.attachments.empty? -%>
  <% if container.is_a?(Version) -%>
  <tr>
    <th colspan="7">
      <%= 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") %> <%= "active" if file.active? %>">
    <td class="active">
      <% have_file = true %>
      <% if active_change_allowed
           active_id = "active-" + file.id.to_s -%>
        <div id="<%= active_id %>">
        <%= link_to image_tag(file.active? ? 'fav.png' : 'fav_off.png'),
              {:controller => 'attachments', :action => 'toggle_active', :project_id => @project.id, :id => file},
	      :remote => true
        %>
        </div>
      <% else -%>
        <%= image_tag('fav.png') if file.active? %>
      <% end -%>
    </td>
    <% if file.active? %>
      <td class="filename active"><%= link_to_attachment file, :download => true %><br><span class="description"><%= h(file.description) %></span></td>
    <% else %>
      <td class="filename"><%= link_to_attachment file, :download => true, :title => file.description %>
    <% end %>
    </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"><%= file.digest %></td>
    <td class="buttons">
    <%= 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 %>
  </tbody>
</table>

<%= l(:text_files_active_change).html_safe if active_change_allowed and have_file %>

<% html_title(l(:label_attachment_plural)) -%>