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
ab8e3a55
Commit
ab8e3a55
authored
Feb 01, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted notifications_form.js to axios
parent
1c8553f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
app/assets/javascripts/notifications_form.js
app/assets/javascripts/notifications_form.js
+19
-19
No files found.
app/assets/javascripts/notifications_form.js
View file @
ab8e3a55
import
{
__
}
from
'
./locale
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
flash
from
'
./flash
'
;
export
default
class
NotificationsForm
{
constructor
()
{
this
.
toggleCheckbox
=
this
.
toggleCheckbox
.
bind
(
this
);
...
...
@@ -27,15 +31,10 @@ export default class NotificationsForm {
saveEvent
(
$checkbox
,
$parent
)
{
const
form
=
$parent
.
parents
(
'
form:first
'
);
return
$
.
ajax
({
url
:
form
.
attr
(
'
action
'
),
method
:
form
.
attr
(
'
method
'
),
dataType
:
'
json
'
,
data
:
form
.
serialize
(),
beforeSend
:
()
=>
{
this
.
showCheckboxLoadingSpinner
(
$parent
);
},
}).
done
((
data
)
=>
{
axios
[
form
.
attr
(
'
method
'
)](
form
.
attr
(
'
action
'
),
form
.
serialize
())
.
then
(({
data
})
=>
{
$checkbox
.
enable
();
if
(
data
.
saved
)
{
$parent
.
find
(
'
.custom-notification-event-loading
'
).
toggleClass
(
'
fa-spin fa-spinner fa-check is-done
'
);
...
...
@@ -45,6 +44,7 @@ export default class NotificationsForm {
.
toggleClass
(
'
fa-spin fa-spinner fa-check is-done
'
);
},
2000
);
}
});
})
.
catch
(()
=>
flash
(
__
(
'
There was an error saving your notification settings.
'
)));
}
}
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