<%= field.name %>
resource dwonload
上传时间:<%= format_date attach.created_on %>类型:软件 上传者:尹刚 下载次数:40
+上传时间:<%= format_date attach.created_on %>类型:<%= attach.tag_list[0] %> 下载次数:<%= attach.downloads%> 引用:<%= attach.quotes.nil? ? 0:attach.quotes %>
diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 89a21ba0e..4834cdb9b 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -1,6 +1,7 @@ # encoding: utf-8 module OrganizationsHelper include ApplicationHelper + include FilesHelper def find_user_not_in_current_org_by_name org @@ -36,4 +37,11 @@ module OrganizationsHelper Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;") end + def get_attach_org2(field) + org_attachments = field.attachments + attachments = User.current.admin? ? org_attachments : visable_attachemnts(org_attachments) + return attachments.sort_by{|x| x.created_on}.reverse.first(6) + # Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;") + end + end diff --git a/app/views/layouts/base_org_newstyle.html.erb b/app/views/layouts/base_org_newstyle.html.erb index 60653b301..4a9dec200 100644 --- a/app/views/layouts/base_org_newstyle.html.erb +++ b/app/views/layouts/base_org_newstyle.html.erb @@ -233,7 +233,7 @@ <% elsif field.field_type == "Resource" %> - <% org_attachs = get_attach_org(field.id) %> + <% org_attachs = get_attach_org2(field) %>
resource dwonload
上传时间:<%= format_date attach.created_on %>类型:软件 上传者:尹刚 下载次数:40
+上传时间:<%= format_date attach.created_on %>类型:<%= attach.tag_list[0] %> 下载次数:<%= attach.downloads%> 引用:<%= attach.quotes.nil? ? 0:attach.quotes %>