% if attachments.nil? || attachments.empty? %>
<% else %>
<% attachments.each do |attach| %>
-
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current && attach.get_apply_resource_status(attach.id, attach.author_id) != 2 && !attach_show_allow(attach) %>
<% else %>
<% end %>
-
<% if attach.is_public == 0 && !attach_show_allow(attach) && attach.get_apply_resource_status(attach.id, attach.author_id) != "2" %>
<%= attach.filename %>
<% else %>
<%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %>
<% end %>
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current %>
<% end %>
-
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current && !attach_show_allow(attach) %>
<% ah = attach.get_status_by_attach(User.current.id) %>
<% if ah.nil? %>
<%= link_to("请求分享", apply_resource_user_path(User.current.id, :attachment_id => attach.id), :class => 'green_btn_share c_white', :remote => true) %>
<% elsif ah == 1 %>
等待回复
<% elsif ah == 2 %>
可引用
<% elsif ah == 3 %>
已拒绝
<% end %>
<% else %>
--
<% end %>
- <%= format_date(attach.created_on) %>
- <%= attach.quotes.nil? ? 0 : attach.quotes %>
- <%= attach.downloads %>
- <%= attach.author_id %>
- <%= (number_to_human_size(attach.filesize)).gsub("ytes", "") %>
- <%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %>
- <%= get_resource_type(attach.container_type)%>
- <%= get_resource_origin(attach) %>
- <%= attach.is_public %>
- <%= attach.get_apply_resource_status(attach.id, User.current.id) %>
- <%= attach_show_allow(attach) == true ? 0 : 1 %>
- <%= attach.id %>
<% end %>
<% end %>