Sha256: cd0a56b587b7c9f50fe619d6297b0d9d543b46e3204763cc67b23d2717821c9c

Contents?: true

Size: 757 Bytes

Versions: 62

Compression:

Stored size: 757 Bytes

Contents

module Workarea
  class User
    module Avatar
      extend ActiveSupport::Concern

      included do
        extend Dragonfly::Model

        field :avatar_name, type: String
        field :avatar_uid, type: String

        dragonfly_accessor :avatar, app: :workarea
      end

      def avatar_image_url
        if avatar.present?
          avatar.process(:avatar).url
        elsif !Rails.env.test?
          gravatar_url
        else
          'workarea/core/placeholder.png'
        end
      end

      def gravatar_url(options = {})
        options = Workarea.config.gravatar_options.merge(options)
        hash = Digest::MD5.hexdigest(email.downcase)
        "https://www.gravatar.com/avatar/#{hash}?#{options.to_query}"
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.15 app/models/workarea/user/avatar.rb
workarea-core-3.4.36 app/models/workarea/user/avatar.rb
workarea-core-3.5.14 app/models/workarea/user/avatar.rb
workarea-core-3.4.35 app/models/workarea/user/avatar.rb
workarea-core-3.5.13 app/models/workarea/user/avatar.rb
workarea-core-3.4.34 app/models/workarea/user/avatar.rb
workarea-core-3.5.12 app/models/workarea/user/avatar.rb
workarea-core-3.4.33 app/models/workarea/user/avatar.rb
workarea-core-3.5.11 app/models/workarea/user/avatar.rb
workarea-core-3.5.10 app/models/workarea/user/avatar.rb
workarea-core-3.4.32 app/models/workarea/user/avatar.rb
workarea-core-3.5.9 app/models/workarea/user/avatar.rb
workarea-core-3.4.31 app/models/workarea/user/avatar.rb
workarea-core-3.5.8 app/models/workarea/user/avatar.rb
workarea-core-3.4.30 app/models/workarea/user/avatar.rb
workarea-core-3.5.7 app/models/workarea/user/avatar.rb
workarea-core-3.4.29 app/models/workarea/user/avatar.rb
workarea-core-3.5.6 app/models/workarea/user/avatar.rb
workarea-core-3.4.28 app/models/workarea/user/avatar.rb
workarea-core-3.5.5 app/models/workarea/user/avatar.rb