Module: Trestle::AvatarHelper
- Defined in:
- app/helpers/trestle/avatar_helper.rb
Instance Method Summary collapse
Instance Method Details
#avatar(options = {}) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'app/helpers/trestle/avatar_helper.rb', line 3 def avatar(={}) fallback = .delete(:fallback) if [:fallback] content_tag(:div, .reverse_merge(class: "avatar")) do concat content_tag(:span, fallback, class: "avatar-fallback") if fallback concat yield if block_given? end end |
#gravatar(email, options = {}) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/helpers/trestle/avatar_helper.rb', line 12 def gravatar(email, ={}) = { d: "mm" }.merge() url = "https://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.to_s.downcase)}.png" url << "?#{.to_query}" if .any? image_tag(url) end |