2015-11-26 09:57:53 +08:00
|
|
|
|
<% unless all_results.nil? || all_results.empty?%>
|
2016-03-14 10:24:50 +08:00
|
|
|
|
<% all_results.each do |item|%>
|
|
|
|
|
<% case item.type %>
|
|
|
|
|
<% when 'user'%>
|
|
|
|
|
<ul class="searchContent">
|
|
|
|
|
<li class="fl"></li>
|
|
|
|
|
<li class="fl searchContentDes">
|
|
|
|
|
<ul class="fl">
|
|
|
|
|
<li class="f16 mb5"><a href="<%= user_path(item.id)%>" class="fontGrey3 fl">
|
|
|
|
|
<%= item.try(:highlight).try(:login) ? item.highlight.login[0].html_safe : item.login %>
|
|
|
|
|
<%if item.firstname.present? || item.lastname.present?%>
|
|
|
|
|
(<%= item.try(:highlight).try(:lastname) ? item.highlight.lastname[0].html_safe : item.lastname%>
|
|
|
|
|
<%= item.try(:highlight).try(:firstname) ? item.highlight.firstname[0].html_safe : item.firstname %>)
|
2015-11-26 09:57:53 +08:00
|
|
|
|
<%end %>
|
2016-03-14 10:24:50 +08:00
|
|
|
|
</a>
|
|
|
|
|
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag"><%= get_user_identity(User.find(item.id).user_extensions.identity) %></span></div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="fontGrey3 mb5"><%= User.find(item.id).user_extensions && User.find(item.id).user_extensions.brief_introduction.present? ? User.find(item.id).user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
|
|
|
|
|
<li class="f12 fontGrey2">
|
|
|
|
|
<span class="mr30">加入时间:<%= format_date( User.find(item.id).created_on)%></span><span class="mr30">
|
2016-06-27 15:36:31 +08:00
|
|
|
|
最后登录时间:<%= format_date( User.find(item.id).last_login_on)%></span><span class="mr30">
|
2015-12-14 10:27:30 +08:00
|
|
|
|
<%= User.find(item.id).user_extensions.occupation.present? ? '单位:'+User.find(item.id).user_extensions.occupation : ''%></span></li>
|
2016-03-14 10:24:50 +08:00
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<div class="cl"></div>
|
2015-11-26 09:57:53 +08:00
|
|
|
|
</ul>
|
2016-03-14 10:24:50 +08:00
|
|
|
|
<% when 'course'%>
|
2015-11-26 09:57:53 +08:00
|
|
|
|
<ul class="searchContent">
|
|
|
|
|
<li class="fl">
|
|
|
|
|
</li>
|
|
|
|
|
<li class="fl searchContentDes">
|
|
|
|
|
<ul class="fl">
|
2015-11-30 11:21:21 +08:00
|
|
|
|
<li class="f16 mb5">
|
|
|
|
|
<a href="<%= course_path(item.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:name) ? item.highlight.name[0].html_safe : item.name %></a>
|
2016-07-01 11:11:53 +08:00
|
|
|
|
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">班级</span></div>
|
2015-11-30 11:21:21 +08:00
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</li>
|
2015-11-26 09:57:53 +08:00
|
|
|
|
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description %></li>
|
2015-12-14 11:11:09 +08:00
|
|
|
|
<li class="f12 fontGrey2">
|
2016-03-14 10:24:50 +08:00
|
|
|
|
<span class="mr30">教师:<%= User.find(item.tea_id).realname %></span>
|
|
|
|
|
<span class="mr30">授课时间:<%= item.time.to_s + item.term%></span>
|
|
|
|
|
<span class="mr30">更新时间:<%= format_date(item.updated_at)%></span>
|
|
|
|
|
<span class="mr30"><%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%></span></li>
|
2015-11-26 09:57:53 +08:00
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</ul>
|
2016-03-14 10:24:50 +08:00
|
|
|
|
<% when 'attachment'%>
|
2015-11-26 09:57:53 +08:00
|
|
|
|
<ul class="searchContent">
|
|
|
|
|
<li class="fl">
|
|
|
|
|
</li>
|
|
|
|
|
<li class="fl searchContentDes">
|
|
|
|
|
<ul class="fl">
|
2015-11-30 11:21:21 +08:00
|
|
|
|
<li class="f16 mb5 fontGrey3"><a href="<%= download_named_attachment_path(item.id,item.filename)%>" class="fontGrey3 mr10 fl"><%= item.try(:highlight).try(:filename) ? item.highlight.filename[0].html_safe : item.filename %></a><span class="f12 fl" style="padding-top: 5px">(<%= number_to_human_size(item.filesize)%>)</span>
|
|
|
|
|
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">资源</span></div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</li>
|
2016-03-14 10:24:50 +08:00
|
|
|
|
<li class="f12 fontGrey2"><span class="mr30">发布者:<%= User.find(item.author_id).login%>(<%= User.find(item.author_id).realname%>)</span>
|
2015-11-26 09:57:53 +08:00
|
|
|
|
<!--<span class="mr30">职称:<%#= get_technical_title User.find(item.author_id) %></span>-->
|
2015-12-14 10:27:30 +08:00
|
|
|
|
<span class="mr30">发布时间:<%= format_date(item.created_on)%></span>
|
|
|
|
|
<span class="mr30">下载次数:<%= item.downloads%>次</span>
|
|
|
|
|
</li>
|
2015-11-26 09:57:53 +08:00
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</ul>
|
2016-03-14 10:24:50 +08:00
|
|
|
|
<% when 'project'%>
|
2015-11-26 09:57:53 +08:00
|
|
|
|
<ul class="searchContent">
|
|
|
|
|
<li class="fl">
|
|
|
|
|
</li>
|
|
|
|
|
<li class="fl searchContentDes">
|
|
|
|
|
<ul class="fl">
|
|
|
|
|
<li class="f16 mb5"><a href="<%= project_path(item.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:name) ? item.highlight.name[0].html_safe : item.name %></a>
|
|
|
|
|
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">项目</span></div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description%></li>
|
2016-03-14 10:24:50 +08:00
|
|
|
|
<li class="f12 fontGrey2"><span class="mr30">管理人员:<%= item.user_id ? User.find(item.user_id).login : '无' %></span><span class="mr30">更新时间:<%= date_format_local( Project.find(item.id).updated_on) %></span></li>
|
2015-11-26 09:57:53 +08:00
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</ul>
|
2015-12-07 14:31:05 +08:00
|
|
|
|
<% when 'memo'%>
|
|
|
|
|
<ul class="searchContent">
|
|
|
|
|
<li class="fl">
|
|
|
|
|
</li>
|
|
|
|
|
<li class="fl searchContentDes">
|
|
|
|
|
<ul class="fl">
|
|
|
|
|
<li class="f16 mb5"><a href="<%= forum_memo_path(:forum_id=>item.forum_id,:id=>item.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:subject) ? item.highlight.subject[0].html_safe : item.subject %></a>
|
|
|
|
|
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">帖子</span></div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:content) ? item.highlight.content[0].html_safe : item.content.html_safe%></li>
|
2016-03-14 10:24:50 +08:00
|
|
|
|
<li class="f12 fontGrey2"><span class="mr30">发帖人:<%= item.author_id ? User.find(item.author_id).login : '无' %></span><span class="mr30">更新时间:<%= format_date( item.updated_at) %></span></li>
|
2015-12-07 14:31:05 +08:00
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</ul>
|
2016-03-14 10:24:50 +08:00
|
|
|
|
<%end %>
|
|
|
|
|
<% end %>
|
2015-11-26 09:57:53 +08:00
|
|
|
|
<div class="pageRoll">
|
|
|
|
|
<%= paginate all_results,:params => {:controller => 'welcome', :action => 'search',:search_type=>'all'}%>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|