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
b6c115b3
Commit
b6c115b3
authored
Jan 21, 2022
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change issuables_helper to use gl_badge_tag
Closes
https://gitlab.com/gitlab-org/gitlab/-/issues/344318
parent
b292b07c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
+6
-9
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+1
-4
spec/helpers/issuables_helper_spec.rb
spec/helpers/issuables_helper_spec.rb
+5
-5
No files found.
app/helpers/issuables_helper.rb
View file @
b6c115b3
...
...
@@ -201,10 +201,7 @@ module IssuablesHelper
count
=
issuables_count_for_state
(
issuable_type
,
state
)
if
count
!=
-
1
html
<<
" "
<<
content_tag
(
:span
,
format_count
(
issuable_type
,
count
,
Gitlab
::
IssuablesCountForState
::
THRESHOLD
),
class:
'badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm gl-display-none gl-sm-display-inline-flex'
)
html
<<
" "
<<
gl_badge_tag
(
format_count
(
issuable_type
,
count
,
Gitlab
::
IssuablesCountForState
::
THRESHOLD
),
{
variant: :muted
,
size: :sm
},
{
class:
"gl-tab-counter-badge gl-display-none gl-sm-display-inline-flex"
})
end
html
.
html_safe
...
...
spec/helpers/issuables_helper_spec.rb
View file @
b6c115b3
...
...
@@ -133,13 +133,13 @@ RSpec.describe IssuablesHelper do
it
'returns navigation with badges'
do
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:opened
,
true
))
.
to
eq
(
'<span>Open</span> <span class="
badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm
gl-display-none gl-sm-display-inline-flex">42</span>'
)
.
to
eq
(
'<span>Open</span> <span class="
gl-badge badge badge-pill badge-muted sm gl-tab-counter-badge
gl-display-none gl-sm-display-inline-flex">42</span>'
)
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:closed
,
true
))
.
to
eq
(
'<span>Closed</span> <span class="
badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm
gl-display-none gl-sm-display-inline-flex">42</span>'
)
.
to
eq
(
'<span>Closed</span> <span class="
gl-badge badge badge-pill badge-muted sm gl-tab-counter-badge
gl-display-none gl-sm-display-inline-flex">42</span>'
)
expect
(
helper
.
issuables_state_counter_text
(
:merge_requests
,
:merged
,
true
))
.
to
eq
(
'<span>Merged</span> <span class="
badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm
gl-display-none gl-sm-display-inline-flex">42</span>'
)
.
to
eq
(
'<span>Merged</span> <span class="
gl-badge badge badge-pill badge-muted sm gl-tab-counter-badge
gl-display-none gl-sm-display-inline-flex">42</span>'
)
expect
(
helper
.
issuables_state_counter_text
(
:merge_requests
,
:all
,
true
))
.
to
eq
(
'<span>All</span> <span class="
badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm
gl-display-none gl-sm-display-inline-flex">42</span>'
)
.
to
eq
(
'<span>All</span> <span class="
gl-badge badge badge-pill badge-muted sm gl-tab-counter-badge
gl-display-none gl-sm-display-inline-flex">42</span>'
)
end
end
...
...
@@ -171,7 +171,7 @@ RSpec.describe IssuablesHelper do
it
'returns truncated count'
do
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:opened
,
true
))
.
to
eq
(
'<span>Open</span> <span class="
badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm
gl-display-none gl-sm-display-inline-flex">1.1k</span>'
)
.
to
eq
(
'<span>Open</span> <span class="
gl-badge badge badge-pill badge-muted sm gl-tab-counter-badge
gl-display-none gl-sm-display-inline-flex">1.1k</span>'
)
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