Sha256: d0bde88305d8c8b53dda74c92d115cec82f6a598489762f0b5aee33b1162e059

Contents?: true

Size: 534 Bytes

Versions: 1

Compression:

Stored size: 534 Bytes

Contents

module Trestle
  module AvatarHelper
    def avatar(options={})
      content_tag(:div, class: "avatar") do
        concat content_tag(:span, options[:fallback], class: "avatar-fallback") if options[:fallback]
        concat yield if block_given?
      end
    end

    def gravatar(email, options={})
      options = { d: "mm" }.merge(options)

      url = "https://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.to_s.downcase)}.png"
      url << "?#{options.to_query}" if options.any?

      image_tag(url)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trestle-0.8.8 app/helpers/trestle/avatar_helper.rb