BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
80f46fe0
Commit
80f46fe0
authored
Mar 20, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '29559-issue-count' into 'master'
handle commas in Issue total count Closes #29559 See merge request !10028
parents
c087ce16
51f07069
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
issue.js
app/assets/javascripts/issue.js
+5
-3
issue_spec.js
spec/javascripts/issue_spec.js
+15
-0
No files found.
app/assets/javascripts/issue.js
View file @
80f46fe0
...
...
@@ -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 @
80f46fe0
...
...
@@ -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