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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
d5079b62
Commit
d5079b62
authored
Mar 19, 2018
by
Jan
Committed by
Sean McGivern
Mar 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "GitLab Community Edition 10.5.3 shows plural for 1 item"
parent
3488382a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
2 deletions
+63
-2
app/views/projects/diffs/_stats.html.haml
app/views/projects/diffs/_stats.html.haml
+2
-2
changelogs/unreleased/44022-singular-1-diff.yml
changelogs/unreleased/44022-singular-1-diff.yml
+5
-0
spec/views/projects/diffs/_stats.html.haml_spec.rb
spec/views/projects/diffs/_stats.html.haml_spec.rb
+56
-0
No files found.
app/views/projects/diffs/_stats.html.haml
View file @
d5079b62
...
@@ -7,9 +7,9 @@
...
@@ -7,9 +7,9 @@
=
icon
(
"caret-down"
,
class:
"prepend-left-5"
)
=
icon
(
"caret-down"
,
class:
"prepend-left-5"
)
%span
.diff-stats-additions-deletions-expanded
#diff-stats
%span
.diff-stats-additions-deletions-expanded
#diff-stats
with
with
%strong
.cgreen
#{
sum_added_lines
}
additions
%strong
.cgreen
=
pluralize
(
sum_added_lines
,
'addition'
)
and
and
%strong
.cred
#{
sum_removed_lines
}
deletions
%strong
.cred
=
pluralize
(
sum_removed_lines
,
'deletion'
)
.diff-stats-additions-deletions-collapsed.pull-right.hidden-xs.hidden-sm
{
"aria-hidden"
:
"true"
,
"aria-describedby"
:
"diff-stats"
}
.diff-stats-additions-deletions-collapsed.pull-right.hidden-xs.hidden-sm
{
"aria-hidden"
:
"true"
,
"aria-describedby"
:
"diff-stats"
}
%strong
.cgreen
<
%strong
.cgreen
<
+
#{
sum_added_lines
}
+
#{
sum_added_lines
}
...
...
changelogs/unreleased/44022-singular-1-diff.yml
0 → 100644
View file @
d5079b62
---
title
:
Use singular in the diff stats if only one line has been changed
merge_request
:
17697
author
:
Jan Beckmann
type
:
fixed
spec/views/projects/diffs/_stats.html.haml_spec.rb
0 → 100644
View file @
d5079b62
require
'spec_helper'
describe
'projects/diffs/_stats.html.haml'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
(
'570e7b2abdd848b95f2f578043fc23bd6f6fd24d'
)
}
def
render_view
render
partial:
"projects/diffs/stats"
,
locals:
{
diff_files:
commit
.
diffs
.
diff_files
}
end
context
'when the commit contains several changes'
do
it
'uses plural for additions'
do
render_view
expect
(
rendered
).
to
have_text
(
'additions'
)
end
it
'uses plural for deletions'
do
render_view
end
end
context
'when the commit contains no addition and no deletions'
do
let
(
:commit
)
{
project
.
commit
(
'4cd80ccab63c82b4bad16faa5193fbd2aa06df40'
)
}
it
'uses plural for additions'
do
render_view
expect
(
rendered
).
to
have_text
(
'additions'
)
end
it
'uses plural for deletions'
do
render_view
expect
(
rendered
).
to
have_text
(
'deletions'
)
end
end
context
'when the commit contains exactly one addition and one deletion'
do
let
(
:commit
)
{
project
.
commit
(
'08f22f255f082689c0d7d39d19205085311542bc'
)
}
it
'uses singular for additions'
do
render_view
expect
(
rendered
).
to
have_text
(
'addition'
)
expect
(
rendered
).
not_to
have_text
(
'additions'
)
end
it
'uses singular for deletions'
do
render_view
expect
(
rendered
).
to
have_text
(
'deletion'
)
expect
(
rendered
).
not_to
have_text
(
'deletions'
)
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