Module: Decidim::OmniauthHelper
- Included in:
- ApplicationHelper
- Defined in:
- app/helpers/decidim/omniauth_helper.rb
Overview
Helper that provides methods to enable or disable omniauth buttons
Instance Method Summary collapse
-
#normalize_provider_name(provider) ⇒ Object
Public: normalize providers names to they can be used for buttons and icons.
-
#oauth_icon(provider) ⇒ Object
Public: icon for omniauth buttons.
-
#provider_name(provider) ⇒ Object
Public: pretty print provider name.
Instance Method Details
#normalize_provider_name(provider) ⇒ Object
Public: normalize providers names to they can be used for buttons and icons.
8 9 10 |
# File 'app/helpers/decidim/omniauth_helper.rb', line 8 def normalize_provider_name(provider) provider.to_s.split("_").first end |
#oauth_icon(provider) ⇒ Object
Public: icon for omniauth buttons
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/decidim/omniauth_helper.rb', line 13 def oauth_icon(provider) info = current_organization.enabled_omniauth_providers[provider.to_sym] if info icon_path = info[:icon_path] return external_icon(icon_path) if icon_path name = info[:icon] end name ||= normalize_provider_name(provider) icon(name) end |
#provider_name(provider) ⇒ Object
Public: pretty print provider name
28 29 30 |
# File 'app/helpers/decidim/omniauth_helper.rb', line 28 def provider_name(provider) provider.to_s.gsub(/_|-/, " ").camelize end |