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
7c4dfb5a
Commit
7c4dfb5a
authored
Feb 02, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted user_tabs.js to use axios
parent
663681f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
app/assets/javascripts/users/user_tabs.js
app/assets/javascripts/users/user_tabs.js
+18
-15
No files found.
app/assets/javascripts/users/user_tabs.js
View file @
7c4dfb5a
import
axios
from
'
../lib/utils/axios_utils
'
;
import
Activities
from
'
../activities
'
;
import
Activities
from
'
../activities
'
;
import
ActivityCalendar
from
'
./activity_calendar
'
;
import
ActivityCalendar
from
'
./activity_calendar
'
;
import
{
localTimeAgo
}
from
'
../lib/utils/datetime_utility
'
;
import
{
localTimeAgo
}
from
'
../lib/utils/datetime_utility
'
;
import
{
__
}
from
'
../locale
'
;
import
flash
from
'
../flash
'
;
/**
/**
* UserTabs
* UserTabs
...
@@ -131,18 +134,20 @@ export default class UserTabs {
...
@@ -131,18 +134,20 @@ export default class UserTabs {
}
}
loadTab
(
action
,
endpoint
)
{
loadTab
(
action
,
endpoint
)
{
return
$
.
ajax
({
this
.
toggleLoading
(
true
);
beforeSend
:
()
=>
this
.
toggleLoading
(
true
),
complete
:
()
=>
this
.
toggleLoading
(
false
),
return
axios
.
get
(
endpoint
)
dataType
:
'
json
'
,
.
then
(({
data
})
=>
{
url
:
endpoint
,
success
:
(
data
)
=>
{
const
tabSelector
=
`div#
${
action
}
`
;
const
tabSelector
=
`div#
${
action
}
`
;
this
.
$parentEl
.
find
(
tabSelector
).
html
(
data
.
html
);
this
.
$parentEl
.
find
(
tabSelector
).
html
(
data
.
html
);
this
.
loaded
[
action
]
=
true
;
this
.
loaded
[
action
]
=
true
;
localTimeAgo
(
$
(
'
.js-timeago
'
,
tabSelector
));
localTimeAgo
(
$
(
'
.js-timeago
'
,
tabSelector
));
},
});
this
.
toggleLoading
(
false
);
})
.
catch
(()
=>
{
this
.
toggleLoading
(
false
);
});
}
}
loadActivities
()
{
loadActivities
()
{
...
@@ -158,17 +163,15 @@ export default class UserTabs {
...
@@ -158,17 +163,15 @@ export default class UserTabs {
utcFormatted
=
`UTC
${
utcOffset
>
0
?
'
+
'
:
''
}${(
utcOffset
/
3600
)}
`
;
utcFormatted
=
`UTC
${
utcOffset
>
0
?
'
+
'
:
''
}${(
utcOffset
/
3600
)}
`
;
}
}
$
.
ajax
({
axios
.
get
(
calendarPath
)
dataType
:
'
json
'
,
.
then
(({
data
})
=>
{
url
:
calendarPath
,
success
:
(
activityData
)
=>
{
$calendarWrap
.
html
(
CALENDAR_TEMPLATE
);
$calendarWrap
.
html
(
CALENDAR_TEMPLATE
);
$calendarWrap
.
find
(
'
.calendar-hint
'
).
append
(
`(Timezone:
${
utcFormatted
}
)`
);
$calendarWrap
.
find
(
'
.calendar-hint
'
).
append
(
`(Timezone:
${
utcFormatted
}
)`
);
// eslint-disable-next-line no-new
// eslint-disable-next-line no-new
new
ActivityCalendar
(
'
.js-contrib-calendar
'
,
activityD
ata
,
calendarActivitiesPath
,
utcOffset
);
new
ActivityCalendar
(
'
.js-contrib-calendar
'
,
d
ata
,
calendarActivitiesPath
,
utcOffset
);
}
,
}
)
}
);
.
catch
(()
=>
flash
(
__
(
'
There was ane error loaing users activity calendar.
'
))
);
// eslint-disable-next-line no-new
// eslint-disable-next-line no-new
new
Activities
();
new
Activities
();
...
...
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