Module: Wallaby::SecureHelper
- Defined in:
- lib/helpers/wallaby/secure_helper.rb
Instance Method Summary collapse
- #logout_method ⇒ Object
- #logout_path(user = current_user, app = main_app) ⇒ Object
- #user_portrait(user = current_user) ⇒ Object
Instance Method Details
#logout_method ⇒ Object
21 22 23 24 |
# File 'lib/helpers/wallaby/secure_helper.rb', line 21 def logout_method method = Array(Devise.sign_out_via).first if defined? Devise method || :delete end |
#logout_path(user = current_user, app = main_app) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/helpers/wallaby/secure_helper.rb', line 11 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 |
#user_portrait(user = current_user) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'lib/helpers/wallaby/secure_helper.rb', line 2 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 |