Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
621a1b62a3dc
Commit
784fedf9
authored
Jan 31, 2018
by
Clement Ho
Browse files
Replace $.ajax in activity calendar with axios
parent
da5eba324ae2
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/assets/javascripts/users/activity_calendar.js
View file @
621a1b62
import
_
from
'
underscore
'
;
import
{
scaleLinear
,
scaleThreshold
}
from
'
d3-scale
'
;
import
{
select
}
from
'
d3-selection
'
;
import
{
getDayName
,
getDayDifference
}
from
'
../lib/utils/datetime_utility
'
;
import
{
getDayName
,
getDayDifference
}
from
'
~/lib/utils/datetime_utility
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
flash
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
const
d3
=
{
select
,
scaleLinear
,
scaleThreshold
};
...
...
@@ -221,14 +224,16 @@ export default class ActivityCalendar {
this
.
currentSelectedDate
.
getDate
(),
].
join
(
'
-
'
);
$
.
ajax
({
url
:
this
.
calendarActivitiesPath
,
data
:
{
date
},
cache
:
false
,
dataType
:
'
html
'
,
beforeSend
:
()
=>
$
(
'
.user-calendar-activities
'
).
html
(
LOADING_HTML
),
success
:
data
=>
$
(
'
.user-calendar-activities
'
).
html
(
data
),
});
$
(
'
.user-calendar-activities
'
).
html
(
LOADING_HTML
);
axios
.
get
(
this
.
calendarActivitiesPath
,
{
params
:
{
date
,
},
responseType
:
'
text
'
,
})
.
then
(({
data
})
=>
$
(
'
.user-calendar-activities
'
).
html
(
data
))
.
catch
(()
=>
flash
(
__
(
'
An error occurred while retrieving calendar activity
'
)));
}
else
{
this
.
currentSelectedDate
=
''
;
$
(
'
.user-calendar-activities
'
).
html
(
''
);
...
...
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