Sha256: 1f1e4835093edf398b2b9dca146a9a3b469f8ba99dd4fad703e864093cfb7bf9

Contents?: true

Size: 774 Bytes

Versions: 2

Compression:

Stored size: 774 Bytes

Contents

module Wallaby::SecureHelper
  def user_portrait(user = current_user)
    if user.respond_to? :email
      image_source = "http#{ request.ssl? ? 's' : '' }://www.gravatar.com/avatar/#{ Digest::MD5.hexdigest user.email.downcase }"
      image_tag image_source, class: 'hidden-xs user-portrait'
    else
      content_tag :i, nil, class: 'glyphicon glyphicon-user user-portrait'
    end
  end

  def logout_path(user = current_user, app = main_app)
    path = if defined? Devise
      scope = Devise::Mapping.find_scope! user
      "destroy_#{ scope }_session_path"
    else
      'logout_path'
    end
    app.public_send path if app.respond_to? path
  end

  def logout_method
    method = Array(Devise.sign_out_via).first if defined? Devise
    method || :delete
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wallaby-4.1.6 lib/helpers/wallaby/secure_helper.rb
wallaby-5.0.1 lib/helpers/wallaby/secure_helper.rb