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
b7d34071
Commit
b7d34071
authored
Nov 10, 2021
by
Tom Quirk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add html_options to gl_tab_counter_badge
parent
60499082
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
app/helpers/tab_helper.rb
app/helpers/tab_helper.rb
+3
-2
spec/helpers/tab_helper_spec.rb
spec/helpers/tab_helper_spec.rb
+6
-0
No files found.
app/helpers/tab_helper.rb
View file @
b7d34071
...
@@ -211,9 +211,10 @@ module TabHelper
...
@@ -211,9 +211,10 @@ module TabHelper
end
end
end
end
def
gl_tab_counter_badge
(
count
)
def
gl_tab_counter_badge
(
count
,
html_options
=
{})
badge_classes
=
%w[badge badge-muted badge-pill gl-badge sm gl-tab-counter-badge]
content_tag
(
:span
,
content_tag
(
:span
,
count
,
count
,
class:
'badge badge-muted badge-pill gl-badge sm gl-tab-counter-badge'
class:
[
*
html_options
[
:class
],
badge_classes
].
join
(
' '
)
)
)
end
end
spec/helpers/tab_helper_spec.rb
View file @
b7d34071
...
@@ -155,5 +155,11 @@ RSpec.describe TabHelper do
...
@@ -155,5 +155,11 @@ RSpec.describe TabHelper do
it
'creates a tab counter badge'
do
it
'creates a tab counter badge'
do
expect
(
gl_tab_counter_badge
(
1
)).
to
eq
(
'<span class="badge badge-muted badge-pill gl-badge sm gl-tab-counter-badge">1</span>'
)
expect
(
gl_tab_counter_badge
(
1
)).
to
eq
(
'<span class="badge badge-muted badge-pill gl-badge sm gl-tab-counter-badge">1</span>'
)
end
end
context
'with extra classes'
do
it
'creates a tab counter badge with the correct class attribute'
do
expect
(
gl_tab_counter_badge
(
1
,
{
class:
'js-test'
})).
to
eq
(
'<span class="js-test badge badge-muted badge-pill gl-badge sm gl-tab-counter-badge">1</span>'
)
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