Module: Devise::RpxConnectable::Helpers
- Defined in:
- lib/devise_rpx_connectable/view_helpers.rb
Overview
RPX view helpers to easily add the link to the RPX connection popup and also the necessary JS code.
Instance Method Summary collapse
-
#embed_rpx(link_url, options = {}) ⇒ Object
Embeds the RPX connection iframe in your page.
-
#javascript_include_rpx(link_url, options = {}) ⇒ Object
Returns the necessary JS code for the RPX popup.
-
#link_to_rpx(link_text, link_url, options = {}) ⇒ Object
Creates the link to the RPX connection popup.
Instance Method Details
#embed_rpx(link_url, options = {}) ⇒ Object
Embeds the RPX connection iframe in your page. By default the RPX frame will refer to the RPX application name you defined in the configuration. It may be overriden using :application_name if the options. The first parameter is the return URL, it must be absolute (***_url). You can override default iframe size using :width and :height in the options.
Example : <%= embed_rpx user_session_url %>
36 37 38 39 40 |
# File 'lib/devise_rpx_connectable/view_helpers.rb', line 36 def (link_url, ={}) token_url = build_token_url(link_url) out = RPXNow.((), token_url, ) out.respond_to?(:html_safe) ? out.html_safe : out end |
#javascript_include_rpx(link_url, options = {}) ⇒ Object
Returns the necessary JS code for the RPX popup. It is recommended to put this code just before the </body> tag of your layout.
For example : … <%= javascript_include_rpx(user_session_url) %> </body> </html>
51 52 53 54 55 |
# File 'lib/devise_rpx_connectable/view_helpers.rb', line 51 def javascript_include_rpx(link_url, ={}) token_url = build_token_url(link_url) out = RPXNow.popup_source((), token_url, ) out.respond_to?(:html_safe) ? out.html_safe : out end |
#link_to_rpx(link_text, link_url, options = {}) ⇒ Object
Creates the link to the RPX connection popup. If you create a link without putting the JS code, the popup will load in a new page. By default the RPX link will be linked to the RPX application name you defined in the configuration. It may be overriden using :application_name if the options. The second parameter is the return URL, it must be absolute (***_url).
For example : <%= link_to_rpx “Signin using RPX!”, user_session_url %>
20 21 22 23 24 25 |
# File 'lib/devise_rpx_connectable/view_helpers.rb', line 20 def link_to_rpx(link_text, link_url, ={}) = { :unobtrusive => true }.merge() token_url = build_token_url(link_url) out = RPXNow.popup_code(link_text, (), token_url, ) out.respond_to?(:html_safe) ? out.html_safe : out end |