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
Léo-Paul Géneau
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
Hide 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
{
export
default
class
NotificationsForm
{
constructor
()
{
constructor
()
{
this
.
toggleCheckbox
=
this
.
toggleCheckbox
.
bind
(
this
);
this
.
toggleCheckbox
=
this
.
toggleCheckbox
.
bind
(
this
);
...
@@ -27,24 +31,20 @@ export default class NotificationsForm {
...
@@ -27,24 +31,20 @@ export default class NotificationsForm {
saveEvent
(
$checkbox
,
$parent
)
{
saveEvent
(
$checkbox
,
$parent
)
{
const
form
=
$parent
.
parents
(
'
form:first
'
);
const
form
=
$parent
.
parents
(
'
form:first
'
);
return
$
.
ajax
({
this
.
showCheckboxLoadingSpinner
(
$parent
);
url
:
form
.
attr
(
'
action
'
),
method
:
form
.
attr
(
'
method
'
),
axios
[
form
.
attr
(
'
method
'
)](
form
.
attr
(
'
action
'
),
form
.
serialize
())
dataType
:
'
json
'
,
.
then
(({
data
})
=>
{
data
:
form
.
serialize
(),
$checkbox
.
enable
();
beforeSend
:
()
=>
{
if
(
data
.
saved
)
{
this
.
showCheckboxLoadingSpinner
(
$parent
);
$parent
.
find
(
'
.custom-notification-event-loading
'
).
toggleClass
(
'
fa-spin fa-spinner fa-check is-done
'
);
},
setTimeout
(()
=>
{
}).
done
((
data
)
=>
{
$parent
.
removeClass
(
'
is-loading
'
)
$checkbox
.
enable
();
.
find
(
'
.custom-notification-event-loading
'
)
if
(
data
.
saved
)
{
.
toggleClass
(
'
fa-spin fa-spinner fa-check is-done
'
);
$parent
.
find
(
'
.custom-notification-event-loading
'
).
toggleClass
(
'
fa-spin fa-spinner fa-check is-done
'
);
},
2000
);
setTimeout
(()
=>
{
}
$parent
.
removeClass
(
'
is-loading
'
)
})
.
find
(
'
.custom-notification-event-loading
'
)
.
catch
(()
=>
flash
(
__
(
'
There was an error saving your notification settings.
'
)));
.
toggleClass
(
'
fa-spin fa-spinner fa-check is-done
'
);
},
2000
);
}
});
}
}
}
}
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