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
51f07069
Commit
51f07069
authored
Mar 17, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle commas in Issue total count
parent
0eff4f14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
app/assets/javascripts/issue.js
app/assets/javascripts/issue.js
+5
-3
spec/javascripts/issue_spec.js
spec/javascripts/issue_spec.js
+15
-0
No files found.
app/assets/javascripts/issue.js
View file @
51f07069
...
...
@@ -2,6 +2,7 @@
/* global Flash */
require
(
'
./flash
'
);
require
(
'
~/lib/utils/text_utility
'
);
require
(
'
vendor/jquery.waitforimages
'
);
require
(
'
./task_list
'
);
...
...
@@ -50,20 +51,21 @@ class Issue {
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
if
(
'
id
'
in
data
)
{
$
(
document
).
trigger
(
'
issuable:change
'
);
const
currentTotal
=
Number
(
$
(
'
.issue_counter
'
).
text
(
));
let
total
=
Number
(
$
(
'
.issue_counter
'
).
text
().
replace
(
/
[^\d]
/
,
''
));
if
(
isClose
)
{
$
(
'
a.btn-close
'
).
addClass
(
'
hidden
'
);
$
(
'
a.btn-reopen
'
).
removeClass
(
'
hidden
'
);
$
(
'
div.status-box-closed
'
).
removeClass
(
'
hidden
'
);
$
(
'
div.status-box-open
'
).
addClass
(
'
hidden
'
);
$
(
'
.issue_counter
'
).
text
(
currentTotal
-
1
)
;
total
-=
1
;
}
else
{
$
(
'
a.btn-reopen
'
).
addClass
(
'
hidden
'
);
$
(
'
a.btn-close
'
).
removeClass
(
'
hidden
'
);
$
(
'
div.status-box-closed
'
).
addClass
(
'
hidden
'
);
$
(
'
div.status-box-open
'
).
removeClass
(
'
hidden
'
);
$
(
'
.issue_counter
'
).
text
(
currentTotal
+
1
)
;
total
+=
1
;
}
$
(
'
.issue_counter
'
).
text
(
gl
.
text
.
addDelimiter
(
total
));
}
else
{
new
Flash
(
issueFailMessage
,
'
alert
'
);
}
...
...
spec/javascripts/issue_spec.js
View file @
51f07069
...
...
@@ -136,6 +136,21 @@ describe('Issue', function() {
expectErrorMessage
();
expect
(
$
(
'
.issue_counter
'
)).
toHaveText
(
1
);
});
it
(
'
updates counter
'
,
()
=>
{
spyOn
(
jQuery
,
'
ajax
'
).
and
.
callFake
(
function
(
req
)
{
expectPendingRequest
(
req
,
$btnClose
);
req
.
success
({
id
:
34
});
});
expect
(
$
(
'
.issue_counter
'
)).
toHaveText
(
1
);
$
(
'
.issue_counter
'
).
text
(
'
1,001
'
);
expect
(
$
(
'
.issue_counter
'
).
text
()).
toEqual
(
'
1,001
'
);
$btnClose
.
trigger
(
'
click
'
);
expect
(
$
(
'
.issue_counter
'
).
text
()).
toEqual
(
'
1,000
'
);
});
});
describe
(
'
reopen issue
'
,
function
()
{
...
...
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