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
4c3dd91f
Commit
4c3dd91f
authored
Feb 07, 2018
by
Fatih Acet
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'axios-profile' into 'master'
Replace $.ajax in profile.js with axios See merge request gitlab-org/gitlab-ce!16895
parents
463957f5
3d4c40a0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
15 deletions
+23
-15
profile.js
app/assets/javascripts/profile/profile.js
+14
-15
user_visits_profile_spec.rb
spec/features/profiles/user_visits_profile_spec.rb
+9
-0
No files found.
app/assets/javascripts/profile/profile.js
View file @
4c3dd91f
/* eslint-disable comma-dangle, no-unused-vars, class-methods-use-this, quotes, consistent-return, func-names, prefer-arrow-callback, space-before-function-paren, max-len */
import
Cookies
from
'js-cookie'
;
import
Flash
from
'../flash'
;
import
{
getPagePath
}
from
'../lib/utils/common_utils'
;
import
{
getPagePath
}
from
'~/lib/utils/common_utils'
;
import
axios
from
'~/lib/utils/axios_utils'
;
import
{
__
}
from
'~/locale'
;
import
flash
from
'../flash'
;
((
global
)
=>
{
class
Profile
{
...
...
@@ -57,8 +59,8 @@ import { getPagePath } from '../lib/utils/common_utils';
onUpdateNotifs
(
e
,
data
)
{
return
data
.
saved
?
new
Flash
(
"Notification settings saved"
,
"notice"
)
:
new
Flash
(
"Failed to save new settings"
,
"alert"
);
flash
(
__
(
'Notification settings saved'
),
'notice'
)
:
flash
(
__
(
'Failed to save new settings'
)
);
}
saveForm
()
{
...
...
@@ -70,21 +72,18 @@ import { getPagePath } from '../lib/utils/common_utils';
formData
.
append
(
'user[avatar]'
,
avatarBlob
,
'avatar.png'
);
}
return
$
.
ajax
({
axios
({
method
:
this
.
form
.
attr
(
'method'
),
url
:
this
.
form
.
attr
(
'action'
),
type
:
this
.
form
.
attr
(
'method'
),
data
:
formData
,
dataType
:
"json"
,
processData
:
false
,
contentType
:
false
,
success
:
response
=>
new
Flash
(
response
.
message
,
'notice'
),
error
:
jqXHR
=>
new
Flash
(
jqXHR
.
responseJSON
.
message
,
'alert'
),
complete
:
()
=>
{
})
.
then
(({
data
})
=>
flash
(
data
.
message
,
'notice'
))
.
then
(()
=>
{
window
.
scrollTo
(
0
,
0
);
// Enable submit button after requests ends
return
self
.
form
.
find
(
':input[disabled]'
).
enable
();
}
}
);
self
.
form
.
find
(
':input[disabled]'
).
enable
();
})
.
catch
(
error
=>
flash
(
error
.
message
)
);
}
setNewRepoCookie
()
{
...
...
spec/features/profiles/user_visits_profile_spec.rb
View file @
4c3dd91f
...
...
@@ -12,4 +12,13 @@ describe 'User visits their profile' do
it
'shows correct menu item'
do
expect
(
page
).
to
have_active_navigation
(
'Profile'
)
end
describe
'profile settings'
,
:js
do
it
'saves updates'
do
fill_in
'user_bio'
,
with:
'bio'
click_button
'Update profile settings'
expect
(
page
).
to
have_content
(
'Profile was successfully updated'
)
end
end
end
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