Sha256: 07e99ae8a2c71c3047760591a61ec9bc711ea358546610330f2d4e17e3d54355
Contents?: true
Size: 863 Bytes
Versions: 5
Compression:
Stored size: 863 Bytes
Contents
# frozen_string_literal: true module Decidim # Helper that provides methods to enable or disable omniauth buttons module OmniauthHelper # Public: normalize providers names to they can be used for buttons # and icons. def normalize_provider_name(provider) return "x" if provider == :twitter provider.to_s.split("_").first end # Public: icon for omniauth buttons 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 # Public: pretty print provider name def provider_name(provider) provider.to_s.gsub(/_|-/, " ").camelize end end end
Version data entries
5 entries across 5 versions & 1 rubygems