Module: Softwear::Auth::Helper

Defined in:
lib/softwear/auth/helper.rb

Instance Method Summary collapse

Instance Method Details

#auth_server_error_bannerObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/softwear/auth/helper.rb', line 13

def auth_server_error_banner
  return unless Softwear::Auth::Model.auth_server_down?

   :div, class: 'alert alert-danger' do
     :strong do
      (Softwear::Auth::Model.auth_server_went_down_at || Time.now).strftime(
        "WARNING: The authentication server is unreachable as of %I:%M%p. "\
        "Some site features might not function properly."
      )
    end
  end
end

#profile_picture_of(user = nil, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/softwear/auth/helper.rb', line 4

def profile_picture_of(user = nil, options = {})
  options[:class] ||= ''
  options[:class] += ' media-object img-rounded profile-pic img img-responsive'
  options[:alt] ||= "#{user.try(:full_name) || '(Unknown)'}'s Avatar"
  options[:title] ||= user.try(:full_name) || 'Someone'

  image_tag user.try(:profile_picture_url) || 'avatar/masarie.jpg', options
end