Module: SocialHelper
- Defined in:
- app/helpers/social_helper.rb
Instance Method Summary collapse
- #box_class ⇒ Object
- #facebook_enabled? ⇒ Boolean
- #facebook_oauth_url ⇒ Object
- #github_enabled? ⇒ Boolean
- #github_oauth_url ⇒ Object
- #google_enabled? ⇒ Boolean
- #google_oauth_url ⇒ Object
- #input_class ⇒ Object
- #label_class ⇒ Object
- #link_to_facebook_login(url) ⇒ Object
- #link_to_github_login(url) ⇒ Object
- #link_to_google_login(url) ⇒ Object
- #link_to_linkedin_login(url) ⇒ Object
- #linkedin_enabled? ⇒ Boolean
- #linkedin_oauth_url ⇒ Object
- #social_login_v2_enabled? ⇒ Boolean
Instance Method Details
#box_class ⇒ Object
2 3 4 |
# File 'app/helpers/social_helper.rb', line 2 def box_class ? 'small col-sm-8' : 'large col-sm-12' end |
#facebook_enabled? ⇒ Boolean
20 21 22 |
# File 'app/helpers/social_helper.rb', line 20 def facebook_enabled? Stormpath::Rails.config.web.facebook_app_id end |
#facebook_oauth_url ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/helpers/social_helper.rb', line 52 def facebook_oauth_url URI::HTTPS.build( host: 'www.facebook.com', path: '/dialog/oauth', query: { client_id: Stormpath::Rails.config.web.facebook_app_id, redirect_uri: facebook_callback_url, scope: Stormpath::Rails.config.web..facebook.scope }.to_query ).to_s end |
#github_enabled? ⇒ Boolean
24 25 26 |
# File 'app/helpers/social_helper.rb', line 24 def github_enabled? Stormpath::Rails.config.web.github_app_id end |
#github_oauth_url ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/helpers/social_helper.rb', line 64 def github_oauth_url URI::HTTPS.build( host: 'www.github.com', path: '/login/oauth/authorize', query: { client_id: Stormpath::Rails.config.web.github_app_id, redirect_uri: github_callback_url, scope: Stormpath::Rails.config.web..github.scope }.to_query ).to_s end |
#google_enabled? ⇒ Boolean
28 29 30 |
# File 'app/helpers/social_helper.rb', line 28 def google_enabled? Stormpath::Rails.config.web.google_app_id end |
#google_oauth_url ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'app/helpers/social_helper.rb', line 76 def google_oauth_url URI::HTTPS.build( host: 'accounts.google.com', path: '/o/oauth2/auth', query: { client_id: Stormpath::Rails.config.web.google_app_id, redirect_uri: google_callback_url, scope: Stormpath::Rails.config.web..google.scope, response_type: 'code' }.to_query ).to_s end |
#input_class ⇒ Object
10 11 12 |
# File 'app/helpers/social_helper.rb', line 10 def input_class ? 'col-sm-12' : 'col-sm-8' end |
#label_class ⇒ Object
6 7 8 |
# File 'app/helpers/social_helper.rb', line 6 def label_class ? 'col-sm-12' : 'col-sm-4' end |
#link_to_facebook_login(url) ⇒ Object
36 37 38 |
# File 'app/helpers/social_helper.rb', line 36 def link_to_facebook_login(url) link_to 'Facebook', url, class: 'btn btn-social btn-facebook' if facebook_enabled? && url.present? end |
#link_to_github_login(url) ⇒ Object
48 49 50 |
# File 'app/helpers/social_helper.rb', line 48 def link_to_github_login(url) link_to 'GitHub', url, class: 'btn btn-social btn-github' if github_enabled? && url.present? end |
#link_to_google_login(url) ⇒ Object
40 41 42 |
# File 'app/helpers/social_helper.rb', line 40 def link_to_google_login(url) link_to 'Google', url, class: 'btn btn-social btn-google' if google_enabled? && url.present? end |
#link_to_linkedin_login(url) ⇒ Object
44 45 46 |
# File 'app/helpers/social_helper.rb', line 44 def link_to_linkedin_login(url) link_to 'LinkedIn', url, class: 'btn btn-social btn-linkedin' if linkedin_enabled? && url.present? end |
#linkedin_enabled? ⇒ Boolean
32 33 34 |
# File 'app/helpers/social_helper.rb', line 32 def linkedin_enabled? Stormpath::Rails.config.web.linkedin_app_id end |
#linkedin_oauth_url ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'app/helpers/social_helper.rb', line 89 def linkedin_oauth_url URI::HTTPS.build( host: 'www.linkedin.com', path: '/oauth/v2/authorization', query: { client_id: Stormpath::Rails.config.web.linkedin_app_id, redirect_uri: linkedin_callback_url, scope: Stormpath::Rails.config.web..linkedin.scope, response_type: 'code' }.to_query ).to_s end |