2014-11-02 08:57:37 -08:00
|
|
|
module UserHelper
|
2014-11-10 22:09:36 -08:00
|
|
|
# Decides what user name to show.
|
|
|
|
# @return [String] The user name
|
2014-11-13 04:02:47 -08:00
|
|
|
def user_screen_name(user, anonymous=false, url=true)
|
2014-11-11 09:09:28 -08:00
|
|
|
return APP_CONFIG['anonymous_name'] if user.nil? || anonymous
|
2014-11-13 04:02:47 -08:00
|
|
|
name = user.display_name.blank? ? user.screen_name : user.display_name
|
2015-01-12 13:44:13 -08:00
|
|
|
return link_to(name, show_user_profile_path(user.screen_name), class: "#{"user--banned" if user.banned?}") if url
|
2014-11-13 04:02:47 -08:00
|
|
|
name
|
2014-11-10 22:09:36 -08:00
|
|
|
end
|
2014-11-02 08:57:37 -08:00
|
|
|
end
|