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
45347914
Commit
45347914
authored
Dec 21, 2015
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds alerts for when http request errors out in some way.
parent
801b801b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
10 deletions
+3
-10
app/assets/javascripts/issue.js.coffee
app/assets/javascripts/issue.js.coffee
+2
-0
spec/javascripts/issue_spec.js.coffee
spec/javascripts/issue_spec.js.coffee
+1
-10
No files found.
app/assets/javascripts/issue.js.coffee
View file @
45347914
...
@@ -27,6 +27,7 @@ class @Issue
...
@@ -27,6 +27,7 @@ class @Issue
url
:
url
,
url
:
url
,
error
:
(
jqXHR
,
textStatus
,
errorThrown
)
->
error
:
(
jqXHR
,
textStatus
,
errorThrown
)
->
issueStatus
=
if
isClose
then
'close'
else
'open'
issueStatus
=
if
isClose
then
'close'
else
'open'
new
Flash
(
"Issues update failed"
,
'alert'
)
success
:
(
data
,
textStatus
,
jqXHR
)
->
success
:
(
data
,
textStatus
,
jqXHR
)
->
if
data
.
saved
if
data
.
saved
$this
.
addClass
(
'hidden'
)
$this
.
addClass
(
'hidden'
)
...
@@ -39,6 +40,7 @@ class @Issue
...
@@ -39,6 +40,7 @@ class @Issue
$
(
'div.issue-box-closed'
).
addClass
(
'hidden'
)
$
(
'div.issue-box-closed'
).
addClass
(
'hidden'
)
$
(
'div.issue-box-open'
).
removeClass
(
'hidden'
)
$
(
'div.issue-box-open'
).
removeClass
(
'hidden'
)
else
else
new
Flash
(
"Issues update failed"
,
'alert'
)
$this
.
prop
(
'disabled'
,
false
)
$this
.
prop
(
'disabled'
,
false
)
disableTaskList
:
->
disableTaskList
:
->
...
...
spec/javascripts/issue_spec.js.coffee
View file @
45347914
...
@@ -31,41 +31,32 @@ describe 'reopen/close issue', ->
...
@@ -31,41 +31,32 @@ describe 'reopen/close issue', ->
expect
(
obj
.
url
).
toBe
(
'http://gitlab/issues/6/close'
)
expect
(
obj
.
url
).
toBe
(
'http://gitlab/issues/6/close'
)
obj
.
success
saved
:
true
obj
.
success
saved
:
true
# setup
$btnClose
=
$
(
'a.btn-close'
)
$btnClose
=
$
(
'a.btn-close'
)
$btnReopen
=
$
(
'a.btn-reopen'
)
$btnReopen
=
$
(
'a.btn-reopen'
)
expect
(
$btnReopen
.
toBeHidden
())
expect
(
$btnReopen
.
toBeHidden
())
expect
(
$btnClose
.
text
()).
toBe
(
'Close'
)
expect
(
$btnClose
.
text
()).
toBe
(
'Close'
)
expect
(
typeof
$btnClose
.
prop
(
'disabled'
)).
toBe
(
'undefined'
)
expect
(
typeof
$btnClose
.
prop
(
'disabled'
)).
toBe
(
'undefined'
)
# excerize
$btnClose
.
trigger
(
'click'
)
$btnClose
.
trigger
(
'click'
)
# verify
expect
(
$btnClose
.
toBeHidden
())
expect
(
$btnClose
.
toBeHidden
())
expect
(
$btnReopen
.
toBeVisible
())
expect
(
$btnReopen
.
toBeVisible
())
expect
(
$
(
'div.issue-box-open'
).
toBeVisible
())
expect
(
$
(
'div.issue-box-open'
).
toBeVisible
())
expect
(
$
(
'div.issue-box-closed'
).
toBeHidden
())
expect
(
$
(
'div.issue-box-closed'
).
toBeHidden
())
# teardown
it
'reopens an issue'
,
->
it
'reopens an issue'
,
->
$
.
ajax
=
(
obj
)
->
$
.
ajax
=
(
obj
)
->
expect
(
obj
.
type
).
toBe
(
'PUT'
)
expect
(
obj
.
type
).
toBe
(
'PUT'
)
expect
(
obj
.
url
).
toBe
(
'http://gitlab/issues/6/reopen'
)
expect
(
obj
.
url
).
toBe
(
'http://gitlab/issues/6/reopen'
)
obj
.
success
saved
:
true
obj
.
success
saved
:
true
# setup
$btnClose
=
$
(
'a.btn-close'
)
$btnClose
=
$
(
'a.btn-close'
)
$btnReopen
=
$
(
'a.btn-reopen'
)
$btnReopen
=
$
(
'a.btn-reopen'
)
expect
(
$btnReopen
.
text
()).
toBe
(
'Reopen'
)
expect
(
$btnReopen
.
text
()).
toBe
(
'Reopen'
)
# excerize
$btnReopen
.
trigger
(
'click'
)
$btnReopen
.
trigger
(
'click'
)
# verify
expect
(
$btnReopen
.
toBeHidden
())
expect
(
$btnReopen
.
toBeHidden
())
expect
(
$btnClose
.
toBeVisible
())
expect
(
$btnClose
.
toBeVisible
())
expect
(
$
(
'div.issue-box-open'
).
toBeVisible
())
expect
(
$
(
'div.issue-box-open'
).
toBeVisible
())
expect
(
$
(
'div.issue-box-closed'
).
toBeHidden
())
expect
(
$
(
'div.issue-box-closed'
).
toBeHidden
())
\ No newline at end of file
# teardown
\ No newline at end of file
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