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
Tatuya Kamada
gitlab-ce
Commits
142432ce
Commit
142432ce
authored
Feb 14, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update issue count when closing/reopening an issue
parent
865e3fcc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
app/assets/javascripts/issue.js
app/assets/javascripts/issue.js
+3
-0
spec/javascripts/issue_spec.js
spec/javascripts/issue_spec.js
+4
-0
No files found.
app/assets/javascripts/issue.js
View file @
142432ce
...
...
@@ -54,16 +54,19 @@ require('vendor/task_list');
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
if
(
'
id
'
in
data
)
{
$
(
document
).
trigger
(
'
issuable:change
'
);
const
currentTotal
=
Number
(
$
(
'
.issue_counter
'
).
text
());
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
);
}
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
);
}
}
else
{
new
Flash
(
issueFailMessage
,
'
alert
'
);
...
...
spec/javascripts/issue_spec.js
View file @
142432ce
...
...
@@ -105,6 +105,7 @@ require('~/issue');
expectIssueState
(
false
);
expect
(
$btnClose
).
toHaveProp
(
'
disabled
'
,
false
);
expect
(
$
(
'
.issue_counter
'
)).
toHaveText
(
0
);
});
it
(
'
fails to close an issue with success:false
'
,
function
()
{
...
...
@@ -121,6 +122,7 @@ require('~/issue');
expectIssueState
(
true
);
expect
(
$btnClose
).
toHaveProp
(
'
disabled
'
,
false
);
expectErrorMessage
();
expect
(
$
(
'
.issue_counter
'
)).
toHaveText
(
1
);
});
it
(
'
fails to closes an issue with HTTP error
'
,
function
()
{
...
...
@@ -135,6 +137,7 @@ require('~/issue');
expectIssueState
(
true
);
expect
(
$btnClose
).
toHaveProp
(
'
disabled
'
,
true
);
expectErrorMessage
();
expect
(
$
(
'
.issue_counter
'
)).
toHaveText
(
1
);
});
});
...
...
@@ -159,6 +162,7 @@ require('~/issue');
expectIssueState
(
true
);
expect
(
$btnReopen
).
toHaveProp
(
'
disabled
'
,
false
);
expect
(
$
(
'
.issue_counter
'
)).
toHaveText
(
1
);
});
});
}).
call
(
this
);
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