Commit f14bc982 authored by Luca Leonardo Scorcia's avatar Luca Leonardo Scorcia

Refactor method calls to make the logic more self-explanatory

parent cd04894e
......@@ -16,8 +16,16 @@ module AuthHelper
Gitlab::Auth.omniauth_enabled?
end
def provider_has_custom_icon?(name)
icon_for_provider(name.to_s)
end
def provider_has_builtin_icon?(name)
PROVIDERS_WITH_ICONS.include?(name.to_s)
end
def provider_has_icon?(name)
PROVIDERS_WITH_ICONS.include?(name.to_s) || icon_for_provider(name.to_s)
provider_has_builtin_icon?(name) || provider_has_custom_icon?(name)
end
def qa_class_for_provider(provider)
......@@ -113,9 +121,9 @@ module AuthHelper
def provider_image_tag(provider, size = 64)
label = label_for_provider(provider)
if icon_for_provider(provider)
if provider_has_custom_icon?(provider)
image_tag(icon_for_provider(provider), alt: label, title: "Sign in with #{label}")
elsif provider_has_icon?(provider)
elsif provider_has_builtin_icon?(provider)
file_name = "#{provider.to_s.split('_').first}_#{size}.png"
image_tag("auth_buttons/#{file_name}", alt: label, title: "Sign in with #{label}")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment