用户邮箱没注册时候显示用户邮箱方法封装
This commit is contained in:
parent
8ba747e195
commit
c84d17bd6a
|
@ -78,14 +78,14 @@ module ApplicationHelper
|
|||
user.nil? ? mail : user.try(:show_name)
|
||||
end
|
||||
|
||||
def link_to_user_mail(mail, options={})
|
||||
def link_to_user_mail(mail, css_class)
|
||||
user = User.find_by_mail(mail)
|
||||
user = user.nil? ? mail : user
|
||||
if user.is_a?(User)
|
||||
name = user.show_name
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id}, :class => user.css_classes
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id}, :class => css_class, :target => "_blank"
|
||||
else
|
||||
h(user.to_s)
|
||||
"<a class='#{css_class}'>#{h(user.to_s)}</a>".html_safe
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue