124 lines
8.0 KiB
Plaintext
124 lines
8.0 KiB
Plaintext
<% unless all_results.nil? || all_results.empty?%>
|
||
<% 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 %>)
|
||
<%end %>
|
||
</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>
|
||
<% user = User.find(item.id)%>
|
||
<li class="fontGrey3 mb5"><%= user.user_extensions && user.user_extensions.brief_introduction.present? ? user.user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
|
||
<li class="f12 fontGrey2">
|
||
<span class="mr30">加入时间:<%= format_date( user.created_on)%></span><span class="mr30">
|
||
最后登录时间:<%= format_date( user.last_login_on)%></span><span class="mr30">
|
||
<%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span></li>
|
||
</ul>
|
||
</li>
|
||
<div class="cl"></div>
|
||
</ul>
|
||
<% when 'syllabus'%>
|
||
<ul class="searchContent w968">
|
||
<li class="f16 mb5 fontGrey3">
|
||
<a href="<%= syllabus_path(item.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:title) ? item.highlight.title[0].html_safe : item.title %>课程</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="f12 fontGrey2">
|
||
<% user = User.find(item.user_id)%>
|
||
<% syllabus = Syllabus.find(item.id) %>
|
||
<span class="mr30">创建者:<%=user.login+"("+user.show_name+")"%></span>
|
||
<span class="mr30">教师团队:<%=syllabus.syllabus_members.count%></span>
|
||
<span class="mr30">班级:<%=syllabus.courses.count%></span>
|
||
<span class="mr30">更新时间:<%=format_date(item.updated_at)%></span>
|
||
<span class="mr30"><%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span>
|
||
</li>
|
||
</ul>
|
||
<% when 'course'%>
|
||
<ul class="searchContent">
|
||
<li class="fl">
|
||
</li>
|
||
<li class="fl searchContentDes">
|
||
<ul class="fl">
|
||
<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>
|
||
<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>
|
||
<li class="f12 fontGrey2">
|
||
<% user = User.find(item.tea_id)%>
|
||
<span class="mr30">教师:<%= user.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.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span></li>
|
||
</ul>
|
||
</li>
|
||
<div class="cl"></div>
|
||
</ul>
|
||
<% when 'attachment'%>
|
||
<ul class="searchContent">
|
||
<li class="fl">
|
||
</li>
|
||
<li class="fl searchContentDes">
|
||
<ul class="fl">
|
||
<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>
|
||
<% user = User.find(item.author_id)%>
|
||
<li class="f12 fontGrey2"><span class="mr30">发布者:<%= user.login%>(<%= user.realname%>)</span>
|
||
<!--<span class="mr30">职称:<%#= get_technical_title User.find(item.author_id) %></span>-->
|
||
<span class="mr30">发布时间:<%= format_date(item.created_on)%></span>
|
||
<span class="mr30">下载次数:<%= item.downloads%>次</span>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<div class="cl"></div>
|
||
</ul>
|
||
<% when 'project'%>
|
||
<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>
|
||
<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>
|
||
</ul>
|
||
</li>
|
||
<div class="cl"></div>
|
||
</ul>
|
||
<% 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>
|
||
<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>
|
||
</ul>
|
||
</li>
|
||
<div class="cl"></div>
|
||
</ul>
|
||
<%end %>
|
||
<% end %>
|
||
<div class="pageRoll">
|
||
<%= paginate all_results,:params => {:controller => 'welcome', :action => 'search',:search_type=>'all'}%>
|
||
</div>
|
||
<% end %>
|