Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f14bc982
Commit
f14bc982
authored
Mar 01, 2020
by
Luca Leonardo Scorcia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor method calls to make the logic more self-explanatory
parent
cd04894e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
app/helpers/auth_helper.rb
app/helpers/auth_helper.rb
+11
-3
No files found.
app/helpers/auth_helper.rb
View file @
f14bc982
...
@@ -16,8 +16,16 @@ module AuthHelper
...
@@ -16,8 +16,16 @@ module AuthHelper
Gitlab
::
Auth
.
omniauth_enabled?
Gitlab
::
Auth
.
omniauth_enabled?
end
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
)
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
end
def
qa_class_for_provider
(
provider
)
def
qa_class_for_provider
(
provider
)
...
@@ -113,9 +121,9 @@ module AuthHelper
...
@@ -113,9 +121,9 @@ module AuthHelper
def
provider_image_tag
(
provider
,
size
=
64
)
def
provider_image_tag
(
provider
,
size
=
64
)
label
=
label_for_provider
(
provider
)
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
}
"
)
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"
file_name
=
"
#{
provider
.
to_s
.
split
(
'_'
).
first
}
_
#{
size
}
.png"
image_tag
(
"auth_buttons/
#{
file_name
}
"
,
alt:
label
,
title:
"Sign in with
#{
label
}
"
)
image_tag
(
"auth_buttons/
#{
file_name
}
"
,
alt:
label
,
title:
"Sign in with
#{
label
}
"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment