feature/share-libs
rb 16 lines 474 Bytes
Raw
1 module UsersHelper
2 # Returns the gravatar for the given user
3 def gravatar_for(user)
4 gravatar_id = Digest::MD5.hexdigest(user.email.downcase)
5 gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}"
6 image_tag(gravatar_url, alt: user.name, class: 'img-thumbnail rounded-circle mx-auto d-block')
7 end
8
9 def nowhereman
10 User.find_by(username: 'nowhereman')
11 end
12
13 def locale_index(locale)
14 I18n.available_locales.find_index(locale)
15 end
16 end