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
Boxiang Sun
gitlab-ce
Commits
3ce6658d
Commit
3ce6658d
authored
May 25, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Warn before moving issue in inline edit form
[ci skip]
parent
625d3442
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
4 deletions
+41
-4
app/assets/javascripts/issue_show/components/app.vue
app/assets/javascripts/issue_show/components/app.vue
+9
-1
app/assets/javascripts/issue_show/components/edit_actions.vue
...assets/javascripts/issue_show/components/edit_actions.vue
+10
-1
app/controllers/concerns/issuable_actions.rb
app/controllers/concerns/issuable_actions.rb
+1
-1
spec/javascripts/issue_show/components/app_spec.js
spec/javascripts/issue_show/components/app_spec.js
+21
-1
No files found.
app/assets/javascripts/issue_show/components/app.vue
View file @
3ce6658d
...
@@ -121,6 +121,14 @@ export default {
...
@@ -121,6 +121,14 @@ export default {
this
.
showForm
=
false
;
this
.
showForm
=
false
;
},
},
updateIssuable
()
{
updateIssuable
()
{
const
canPostUpdate
=
this
.
store
.
formState
.
move_to_project_id
!==
0
?
confirm
(
'
Are you sure you want to move this issue to another project?
'
)
:
true
;
// eslint-disable-line no-alert
if
(
!
canPostUpdate
)
{
eventHub
.
$emit
(
'
enable.submit.btn
'
);
return
;
}
this
.
service
.
updateIssuable
(
this
.
store
.
formState
)
this
.
service
.
updateIssuable
(
this
.
store
.
formState
)
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
res
.
json
())
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
...
@@ -149,7 +157,7 @@ export default {
...
@@ -149,7 +157,7 @@ export default {
// Stop the poll so we don't get 404's with the issue not existing
// Stop the poll so we don't get 404's with the issue not existing
this
.
poll
.
stop
();
this
.
poll
.
stop
();
gl
.
utils
.
visitUrl
(
data
.
path
);
gl
.
utils
.
visitUrl
(
data
.
web_url
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
eventHub
.
$emit
(
'
close.form
'
);
eventHub
.
$emit
(
'
close.form
'
);
...
...
app/assets/javascripts/issue_show/components/edit_actions.vue
View file @
3ce6658d
...
@@ -24,6 +24,9 @@
...
@@ -24,6 +24,9 @@
},
},
},
},
methods
:
{
methods
:
{
enableSubmit
()
{
this
.
updateLoading
=
false
;
},
updateIssuable
()
{
updateIssuable
()
{
this
.
updateLoading
=
true
;
this
.
updateLoading
=
true
;
eventHub
.
$emit
(
'
update.issuable
'
);
eventHub
.
$emit
(
'
update.issuable
'
);
...
@@ -40,6 +43,12 @@
...
@@ -40,6 +43,12 @@
}
}
},
},
},
},
created
()
{
eventHub
.
$on
(
'
enable.submit.btn
'
,
this
.
enableSubmit
);
},
beforeDestroy
()
{
eventHub
.
$off
(
'
enable.submit.btn
'
,
this
.
enableSubmit
);
},
};
};
</
script
>
</
script
>
...
@@ -50,7 +59,7 @@
...
@@ -50,7 +59,7 @@
:class=
"
{ disabled: updateLoading || !isSubmitEnabled }"
:class=
"
{ disabled: updateLoading || !isSubmitEnabled }"
type="submit"
type="submit"
:disabled="updateLoading || !isSubmitEnabled"
:disabled="updateLoading || !isSubmitEnabled"
@click="updateIssuable">
@click
.prevent
="updateIssuable">
Save changes
Save changes
<i
<i
class=
"fa fa-spinner fa-spin"
class=
"fa fa-spinner fa-spin"
...
...
app/controllers/concerns/issuable_actions.rb
View file @
3ce6658d
...
@@ -20,7 +20,7 @@ module IssuableActions
...
@@ -20,7 +20,7 @@ module IssuableActions
format
.
html
{
redirect_to
index_path
}
format
.
html
{
redirect_to
index_path
}
format
.
json
do
format
.
json
do
render
json:
{
render
json:
{
path
:
index_path
web_url
:
index_path
}
}
end
end
end
end
...
...
spec/javascripts/issue_show/components/app_spec.js
View file @
3ce6658d
...
@@ -32,13 +32,16 @@ describe('Issuable output', () => {
...
@@ -32,13 +32,16 @@ describe('Issuable output', () => {
canMove
:
true
,
canMove
:
true
,
endpoint
:
'
/gitlab-org/gitlab-shell/issues/9/realtime_changes
'
,
endpoint
:
'
/gitlab-org/gitlab-shell/issues/9/realtime_changes
'
,
issuableRef
:
'
#1
'
,
issuableRef
:
'
#1
'
,
initialTitle
:
''
,
initialTitleHtml
:
''
,
initialTitleText
:
''
,
initialDescriptionHtml
:
''
,
initialDescriptionHtml
:
''
,
initialDescriptionText
:
''
,
initialDescriptionText
:
''
,
markdownPreviewUrl
:
'
/
'
,
markdownPreviewUrl
:
'
/
'
,
markdownDocs
:
'
/
'
,
markdownDocs
:
'
/
'
,
projectsAutocompleteUrl
:
'
/
'
,
projectsAutocompleteUrl
:
'
/
'
,
isConfidential
:
false
,
isConfidential
:
false
,
projectNamespace
:
'
/
'
,
projectPath
:
'
/
'
,
},
},
}).
$mount
();
}).
$mount
();
});
});
...
@@ -224,6 +227,23 @@ describe('Issuable output', () => {
...
@@ -224,6 +227,23 @@ describe('Issuable output', () => {
});
});
});
});
it
(
'
does not update issuable if project move confirm is false
'
,
(
done
)
=>
{
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
false
);
spyOn
(
vm
.
service
,
'
updateIssuable
'
);
vm
.
store
.
formState
.
move_to_project_id
=
1
;
vm
.
updateIssuable
();
setTimeout
(()
=>
{
expect
(
vm
.
service
.
updateIssuable
,
).
not
.
toHaveBeenCalled
();
done
();
});
});
it
(
'
closes form on error
'
,
(
done
)
=>
{
it
(
'
closes form on error
'
,
(
done
)
=>
{
spyOn
(
window
,
'
Flash
'
).
and
.
callThrough
();
spyOn
(
window
,
'
Flash
'
).
and
.
callThrough
();
spyOn
(
vm
.
service
,
'
updateIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
,
reject
)
=>
{
spyOn
(
vm
.
service
,
'
updateIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
,
reject
)
=>
{
...
...
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