新版资源类型定制模式6

This commit is contained in:
huang 2016-05-31 14:41:50 +08:00
parent 6bfe344cbf
commit bb7204846f
2 changed files with 146 additions and 92 deletions

View File

@ -44,9 +44,8 @@ module OrganizationsHelper
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;")
attachments = User.current.admin? ? org_attachments.first(5) : visable_attachemnts(org_attachments).first(5)
attachments.sort_by{|x| x.created_on}.reverse
end
# 从内容中获取路径

View File

@ -1,91 +1,146 @@
<div class="por_teachers">
<ul id="por_teachers_nav">
<li id="por_teachers_nav_1" class="por_teachers_hover" onclick="HoverLi(1);">
<a href="javascript:void(0);" class="por_teachers_type" >名师风采</a>
</li>
<li id="por_teachers_nav_2" onclick="HoverLi(2);">
<a href="javascript:void(0);" class="por_teachers_type" >学生英雄榜</a>
</li>
<a href="javascript:void(0);" target="_blank" class="por_more_index fr mt5">更多></a>
<div class="cl"></div>
</ul>
<div id="por_teachers_content_1" >
<ul class="por_teachers_li">
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华张晓华张晓华张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学学技术大学学技术大学学技术大学学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<% if field.field_type == "Resource" %>
<div class="por_teachers" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="por_h2_index clear"><%= field.name %><%= link_to "更多", org_subfield_files_path(field), :target => "_blank", :class => "por_more_index fr" %></h2>
<div id="por_teachers_content_1" >
<ul class="por_teachers_li">
<% get_attach_org2(field).each do |attach| %>
<li >
<%= link_to image_tag(url_to_avatar(attach.author),:width => "43", :height => "43", :class => "por_teachers_img fl mr15"), user_path(attach.author), :target => "_blank", :class => "fl" %>
<!--<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>-->
<div class="por_teachers_txt fl mt5">
<%= link_to attach.author, user_path(attach.author), :class => " por_teachers_name fl", :target => "_blank" %>
<p class="por_teachers_p fr">
<%= link_to truncate(attach.filename,length: 20, 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;" %>
</p>
<div class="cl"></div>
<p class="por_teachers_span ">
<span class="mr10">类型:<span><%= attach.tag_list[0] %></span></span>
<span class="mr10">下载:<span><%= attach.downloads %></span></span>
<span class="mr10">引用:<span><%= attach.quotes.nil? ? 0 : attach.quotes %></span></span>
</p>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div>
<div id="por_teachers_content_2" class="undis">
<ul class="por_teachers_li">
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华张晓华张晓华张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学学技术大学学技术大学学技术大学学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
</ul>
</div>
</div>
<% else %>
<div class="por_teachers">
<ul id="por_teachers_nav">
<li id="por_teachers_nav_1" class="por_teachers_hover" onclick="HoverLi(1);">
<a href="javascript:void(0);" class="por_teachers_type" >名师风采</a>
</li>
<li id="por_teachers_nav_2" onclick="HoverLi(2);">
<a href="javascript:void(0);" class="por_teachers_type" >学生英雄榜</a>
</li>
<a href="javascript:void(0);" target="_blank" class="por_more_index fr mt5">更多></a>
<div class="cl"></div>
</li>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
</ul>
<div id="por_teachers_content_1" >
<ul class="por_teachers_li">
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华张晓华张晓华张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学学技术大学学技术大学学技术大学学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
</ul>
</div>
<div id="por_teachers_content_2" class="undis">
<ul class="por_teachers_li">
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华张晓华张晓华张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学学技术大学学技术大学学技术大学学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
</ul>
</div>
</div>
</ul>
</div>
<div id="por_teachers_content_2" class="undis">
<ul class="por_teachers_li">
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华张晓华张晓华张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学学技术大学学技术大学学技术大学学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>
<div class="por_teachers_txt fl mt5">
<a href="javascript:void(0);" target="_blank" class=" por_teachers_name fl"> 张晓华 </a>
<p class="por_teachers_p fr">国防科学技术大学</p>
<div class="cl"></div>
<p class="por_teachers_span "><span class=" mr10">博客<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10"> 课程<a href="javascript:void(0);" target="_blank" >20</a></span><span class="mr10">学生 <a href="javascript:void(0);" target="_blank" >20</a></span></p>
</div>
<div class="cl"></div>
</li>
</ul>
</div>
</div>
<% end %>