Module: Devise::DeviseLoginza::Helpers
- Defined in:
- lib/devise_loginza/view_helpers.rb
Instance Method Summary collapse
-
#loginza_button_tag(*args, &block) ⇒ Object
Loginza button.
-
#loginza_frame_tag(callback_url, options = {}, html_options = {}) ⇒ Object
Loginza frame.
- #loginza_js ⇒ Object
Instance Method Details
#loginza_button_tag(*args, &block) ⇒ Object
Loginza button
Simple example:
<%= loginza_button_tag("Login via OpenID", clients_url) %>
With set of providers:
<%= loginza_button_tag("Login via OpenID", clients_url, :providers => [ :google, :facebook, :twitter ]) %>
With default provider:
<%= loginza_button_tag("Login via OpenID", clients_url, :provider => :google) %>
With a block:
<%= loginza_button_tag(clients_url, :provider => :google) do %>
<div class='loginza'>
...
</div>
<% end %>
Supported providers:
google, yandex, mailruapi, mailru, vkontakte, facebook, twitter, loginza, myopenid, webmoney, rambler, flickr, lastfm, verisign, aol, steam, openid.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/devise_loginza/view_helpers.rb', line 31 def (*args, &block) if block_given? callback_url = args.first = args.second || {} = args.third (capture(&block), callback_url, , ) else name = args[0] callback_url = args[1] = args[2] || {} = args[3] || {} [:class] ||= "loginza" url = generate_url(callback_url, ) html = "" html << javascript_include_tag("http://s1.loginza.ru/js/widget.js") html << link_to(name, url, , ) html end end |
#loginza_frame_tag(callback_url, options = {}, html_options = {}) ⇒ Object
Loginza frame
Simple example:
<%= loginza_frame_tag(clients_url, { :providers => [:google, :yandex, :mailru] }, { :style => "width:400px;height:350px;" }) %>
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/devise_loginza/view_helpers.rb', line 60 def loginza_frame_tag(callback_url, = {}, = {}) = { :scrolling => "no", :frameborder => "no", :style => "width:359px;height:300px;", }.merge() [:src] = generate_url(callback_url, , { :overlay => 'loginza' }) content_tag(:iframe, nil, ) end |
#loginza_js ⇒ Object
6 7 8 |
# File 'lib/devise_loginza/view_helpers.rb', line 6 def loginza_js javascript_include_tag("http://s1.loginza.ru/js/widget.js") end |