Merge branch 'FX-alan-search-404' into alan_develop
This commit is contained in:
commit
5343759f2f
|
@ -1064,6 +1064,16 @@ class User < Principal
|
|||
anonymous_user
|
||||
end
|
||||
|
||||
# refactor User model find function,
|
||||
# return anonymous user when can not find user id = user_id
|
||||
def self.find (*args, &block)
|
||||
begin
|
||||
super
|
||||
rescue
|
||||
self.anonymous
|
||||
end
|
||||
# super
|
||||
end
|
||||
# Salts all existing unsalted passwords
|
||||
# It changes password storage scheme from SHA1(password) to SHA1(salt + SHA1(password))
|
||||
# This method is used in the SaltPasswords migration and is to be kept as is
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
<% 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 %>)
|
||||
<% 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>
|
||||
<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">
|
||||
</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">
|
||||
最后登陆时间:<%= format_date( User.find(item.id).last_login_on)%></span><span class="mr30">
|
||||
<%= User.find(item.id).user_extensions.occupation.present? ? '单位:'+User.find(item.id).user_extensions.occupation : ''%></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% when 'course'%>
|
||||
<% when 'course'%>
|
||||
<ul class="searchContent">
|
||||
<li class="fl">
|
||||
</li>
|
||||
|
@ -46,7 +46,7 @@
|
|||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% when 'attachment'%>
|
||||
<% when 'attachment'%>
|
||||
<ul class="searchContent">
|
||||
<li class="fl">
|
||||
</li>
|
||||
|
@ -65,7 +65,7 @@
|
|||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% when 'project'%>
|
||||
<% when 'project'%>
|
||||
<ul class="searchContent">
|
||||
<li class="fl">
|
||||
</li>
|
||||
|
@ -97,8 +97,8 @@
|
|||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<%end %>
|
||||
<% end %>
|
||||
<%end %>
|
||||
<% end %>
|
||||
<div class="pageRoll">
|
||||
<%= paginate all_results,:params => {:controller => 'welcome', :action => 'search',:search_type=>'all'}%>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue