Module: Balrog::ViewHelpers

Defined in:
lib/balrog/view_helpers.rb

Overview

ViewHelpers methods are made available in all views by the code in engine.rb.

Instance Method Summary collapse

Instance Method Details

#balrog_logout_button(options = nil, html_options = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/balrog/view_helpers.rb', line 3

def balrog_logout_button(options = nil, html_options = nil)
  name = 'Logout'
  html_options ||= {}
  html_options[:method] = 'delete'

  if options.is_a?(String)
    name = options
  elsif options.is_a?(Hash)
    html_options = html_options.merge(options)
  end 

  button_to(name, '/balrog/logout', html_options)
end

#balrog_omniauth_configured?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/balrog/view_helpers.rb', line 21

def balrog_omniauth_configured?
  !!Balrog::Middleware.omniauth_config
end

#show_balrog_password_prompt?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/balrog/view_helpers.rb', line 17

def show_balrog_password_prompt?
  !!Balrog::Middleware.password_hash || !Balrog::Middleware.omniauth_config
end