Module: LamAuth::Helpers

Defined in:
lib/lam_auth/helpers.rb

Instance Method Summary collapse

Instance Method Details

#lam_auth_include_tagObject



3
4
5
# File 'lib/lam_auth/helpers.rb', line 3

def lam_auth_include_tag
  javascript_include_tag(LamAuth.config['api_url'])
end

#lam_auth_init_tag(options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/lam_auth/helpers.rb', line 7

def lam_auth_init_tag(options = {})
  options.reverse_merge!(
    :app_id          => LamAuth.app['app_id'],
    :panel_node_id   => "#{LamAuth.config['prefix']}-root", 
    :fixed           => false
  )      
  options.reverse_merge!(:xd_receiver_url => LamAuth.app['return_url']) if LamAuth.app['return_url']
  
  javascript_tag("#{LamAuth.config['api']}.init({#{options.map{|k, v| "#{k.to_s.camelize(:lower)}: #{v.inspect}"}.join(",\n")}});")
end