summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2017-07-18 17:05:41 -0500
committerMike Greiling <mike@pixelcog.com>2017-07-18 17:05:41 -0500
commit339baf8f5d7716baa1a6924c94f1896cf8f6805f (patch)
tree37845f7055e3d2f5a76445182f66237f33f1276d /app/assets
parent651bf36cc5d485a7c136f93b21b97bc807dd2188 (diff)
downloadgitlab-ce-339baf8f5d7716baa1a6924c94f1896cf8f6805f.tar.gz
refactor async calendar data
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/users/index.js2
-rw-r--r--app/assets/javascripts/users/user_tabs.js27
2 files changed, 25 insertions, 4 deletions
diff --git a/app/assets/javascripts/users/index.js b/app/assets/javascripts/users/index.js
index ecd8e09161e..c9d5da5c5f9 100644
--- a/app/assets/javascripts/users/index.js
+++ b/app/assets/javascripts/users/index.js
@@ -1,7 +1,5 @@
-import ActivityCalendar from './activity_calendar';
import User from './user';
// use legacy exports until embedded javascript is refactored
-window.Calendar = ActivityCalendar;
window.gl = window.gl || {};
window.gl.User = User;
diff --git a/app/assets/javascripts/users/user_tabs.js b/app/assets/javascripts/users/user_tabs.js
index f8e23c8624d..c499c403e28 100644
--- a/app/assets/javascripts/users/user_tabs.js
+++ b/app/assets/javascripts/users/user_tabs.js
@@ -1,5 +1,7 @@
/* eslint-disable max-len, space-before-function-paren, no-underscore-dangle, consistent-return, comma-dangle, no-unused-vars, dot-notation, no-new, no-return-assign, camelcase, no-param-reassign, class-methods-use-this */
+import ActivityCalendar from './activity_calendar';
+
/*
UserTabs
@@ -60,6 +62,15 @@ content on the Users#show page.
</div>
*/
+const CALENDAR_TEMPLATE = `
+ <div class="clearfix calendar">
+ <div class="js-contrib-calendar"></div>
+ <div class="calendar-hint">
+ Summary of issues, merge requests, push events, and comments
+ </div>
+ </div>
+`;
+
export default class UserTabs {
constructor ({ defaultAction, action, parentEl }) {
this.loaded = {};
@@ -147,9 +158,21 @@ export default class UserTabs {
return;
}
const $calendarWrap = this.$parentEl.find('.user-calendar');
- $calendarWrap.load($calendarWrap.data('href'));
+ const calendarPath = $calendarWrap.data('calendarPath');
+ const calendarActivitiesPath = $calendarWrap.data('calendarActivitiesPath');
+
+ $.ajax({
+ dataType: 'json',
+ type: 'GET',
+ url: calendarPath,
+ success: (activityData) => {
+ $calendarWrap.html(CALENDAR_TEMPLATE);
+ new ActivityCalendar(activityData, calendarActivitiesPath);
+ }
+ });
+
new gl.Activities();
- return this.loaded['activity'] = true;
+ this.loaded['activity'] = true;
}
toggleLoading(status) {