组织资源的统计与权限
This commit is contained in:
parent
961a264e05
commit
8a6a1b94ee
|
@ -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
|
||||
|
|
|
@ -233,7 +233,7 @@
|
|||
</div><!--content end-->
|
||||
</div> <!--box1 end-->
|
||||
<% elsif field.field_type == "Resource" %>
|
||||
<% org_attachs = get_attach_org(field.id) %>
|
||||
<% org_attachs = get_attach_org2(field) %>
|
||||
<div class="box1" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
|
||||
<div class="content">
|
||||
<div class="box-top" id="resource_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2><p class="box-title-p">resource dwonload</p></div>
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
<%= link_to truncate(attach.filename,length: 35, omission: '...'),
|
||||
download_named_attachment_path(attach.id, attach.filename),
|
||||
:title => attach.filename+"\n"+attach.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :class => "fl ziyuan-title" %>
|
||||
<p class="fl"><span >上传时间:<%= format_date attach.created_on %></span><span>类型:软件</span><span> 上传者:尹刚</span> <span>下载次数:40</span></p>
|
||||
<p class="fl"><span >上传时间:<%= format_date attach.created_on %></span><span>类型:<%= attach.tag_list[0] %></span><span> 下载次数:<%= attach.downloads%></span> <span>引用:<%= attach.quotes.nil? ? 0:attach.quotes %></span></p>
|
||||
</div>
|
||||
<a href="#" class="download-btn fl" >下载</a>
|
||||
<%= link_to "下载", download_named_attachment_path(attach.id, attach.filename), :class => "download-btn fl" %>
|
||||
<div class="cl"></div>
|
||||
</div><!--row-ziyuan end-->
|
||||
<% end %>
|
Loading…
Reference in New Issue