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
e301f300
Commit
e301f300
authored
Jan 31, 2022
by
Alexander Turinske
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove icon_size option for gl_badge_helper
- we should not allow customisation of the icon size
parent
fffb3db6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
13 deletions
+4
-13
app/helpers/badges_helper.rb
app/helpers/badges_helper.rb
+1
-6
app/views/layouts/nav/_classification_level_banner.html.haml
app/views/layouts/nav/_classification_level_banner.html.haml
+1
-1
spec/helpers/badges_helper_spec.rb
spec/helpers/badges_helper_spec.rb
+2
-6
No files found.
app/helpers/badges_helper.rb
View file @
e301f300
...
@@ -87,12 +87,7 @@ module BadgesHelper
...
@@ -87,12 +87,7 @@ module BadgesHelper
if
options
[
:icon
]
if
options
[
:icon
]
icon_classes
=
GL_ICON_CLASSES
.
dup
icon_classes
=
GL_ICON_CLASSES
.
dup
icon_classes
<<
"gl-mr-2"
unless
icon_only
icon_classes
<<
"gl-mr-2"
unless
icon_only
icon
=
sprite_icon
(
options
[
:icon
],
css_class:
icon_classes
.
join
(
' '
))
icon
=
if
options
[
:icon_size
]
sprite_icon
(
options
[
:icon
],
size:
options
[
:icon_size
],
css_class:
icon_classes
.
join
(
' '
))
else
sprite_icon
(
options
[
:icon
],
css_class:
icon_classes
.
join
(
' '
))
end
content
=
icon_only
?
icon
:
icon
+
content
content
=
icon_only
?
icon
:
icon
+
content
end
end
...
...
app/views/layouts/nav/_classification_level_banner.html.haml
View file @
e301f300
-
if
::
Gitlab
::
ExternalAuthorization
.
enabled?
&&
@project
-
if
::
Gitlab
::
ExternalAuthorization
.
enabled?
&&
@project
=
content_for
:header_content
do
=
content_for
:header_content
do
=
gl_badge_tag
(
@project
.
external_authorization_classification_label
,
{
variant: :danger
,
icon:
'lock-open'
,
icon_size:
8
},
{
class:
'has-tooltip'
,
title:
s_
(
'ExternalAuthorizationService|Classification label'
)
})
=
gl_badge_tag
(
@project
.
external_authorization_classification_label
,
{
variant: :danger
,
icon:
'lock-open'
},
{
class:
'has-tooltip'
,
title:
s_
(
'ExternalAuthorizationService|Classification label'
)
})
spec/helpers/badges_helper_spec.rb
View file @
e301f300
...
@@ -113,13 +113,9 @@ RSpec.describe BadgesHelper do
...
@@ -113,13 +113,9 @@ RSpec.describe BadgesHelper do
it
'adds aria-label to element'
do
it
'adds aria-label to element'
do
expect
(
subject
).
to
match
(
%r{<span .*aria-label="
#{
label
}
".*>}
)
expect
(
subject
).
to
match
(
%r{<span .*aria-label="
#{
label
}
".*>}
)
end
end
end
describe
'icon size'
do
subject
{
helper
.
gl_badge_tag
(
label
,
icon:
'question-o'
,
icon_size:
8
)
}
it
'
adds an img role to element
'
do
it
'
does not add a spacing class to the icon
'
do
expect
(
subject
).
to
match
(
%r{<svg .*class="s8.*".*>}
)
expect
(
subject
).
not_to
match
(
spacing_class_regex
)
end
end
end
end
end
end
...
...
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