archive/app/views/admin/archive_files/_index.html.erb

56 lines
1.9 KiB
Plaintext

<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>
<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<% if f == "archive.downloaded_times" %>
<%= thead(f,true,false) %>
<% else %>
<%= thead(f) %>
<% end %>
<% end %>
</tr>
</thead>
<tbody>
<% @archives.each do |archive| %>
<tr>
<td><%= archive.status_for_table %></td>
<td>
<%= archive.category.title rescue "" %>
<% if (archive.category.disable rescue false) %>
<span class='label'><%= t(:disabled) %></span>
<% end %>
</td>
<td>
<a href="/admin/archive_files/show?title=<%= archive.title %>" target="_blank"><%= archive.title %></a>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(archive) %>
<li><a href="/<%= I18n.locale.to_s %>/admin/archive_files/<%= archive.id.to_s %>/edit"><%= t(:edit) %></a></li>
<li><a href="/admin/archive_files/<%= archive.id.to_s %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
<td><%= format_value archive.updated_at rescue nil %></td>
<td><%= User.find(archive.update_user_id).user_name rescue nil %></td>
<% download_total = 0
archive.archive_file_multiples.each do |afm|
download_total = download_total + afm.download_count
end
%>
<td><%= download_total %></td>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag(:div, paginate(@archives), class: "pagination pagination-centered") +
content_tag(:div, link_to(t(:new_),new_admin_archive_file_path, :class=>"btn btn-primary"), class: "pull-right")
end
%>