Module: Loginza::ViewHelper
- Includes:
- ActionView::Helpers::AssetTagHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper
- Defined in:
- lib/loginza/view_helper.rb
Instance Method Summary collapse
-
#loginza_button_tag(*args, &block) ⇒ Object
Loginza button.
-
#loginza_frame_tag(callback_url, options = {}, html_options = {}) ⇒ Object
Loginza frame.
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.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/loginza/view_helper.rb', line 29 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" without_js = .delete(:without_js) url = Utils.generate_url(callback_url, ) html = Utils.new_safe_buffer html << javascript_include_tag("http://s1.loginza.ru/js/widget.js") unless without_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/loginza/view_helper.rb', line 60 def loginza_frame_tag(callback_url, = {}, = {}) = { :scrolling => "no", :frameborder => "no", :style => "width:359px;height:300px;", }.merge() [:src] = Utils.generate_url(callback_url, , { :overlay => 'loginza' }) content_tag(:iframe, nil, ) end |