Retrospring/app/helpers/user_helper.rb

11 lines
387 B
Ruby
Raw Normal View History

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
return link_to(name, show_user_profile_path(current_user.screen_name)) if url
name
2014-11-10 22:09:36 -08:00
end
2014-11-02 08:57:37 -08:00
end