diff options
Diffstat (limited to 'app/assets/javascripts/pages/users')
-rw-r--r-- | app/assets/javascripts/pages/users/activity_calendar.js | 29 | ||||
-rw-r--r-- | app/assets/javascripts/pages/users/index.js | 6 | ||||
-rw-r--r-- | app/assets/javascripts/pages/users/user_tabs.js | 20 |
3 files changed, 24 insertions, 31 deletions
diff --git a/app/assets/javascripts/pages/users/activity_calendar.js b/app/assets/javascripts/pages/users/activity_calendar.js index 54666af540e..149e666256b 100644 --- a/app/assets/javascripts/pages/users/activity_calendar.js +++ b/app/assets/javascripts/pages/users/activity_calendar.js @@ -42,11 +42,7 @@ function formatTooltipText({ date, count }) { return `${contribText}<br />${dateDayName} ${dateText}`; } -const initColorKey = () => - d3 - .scaleLinear() - .range(['#acd5f2', '#254e77']) - .domain([0, 3]); +const initColorKey = () => d3.scaleLinear().range(['#acd5f2', '#254e77']).domain([0, 3]); export default class ActivityCalendar { constructor( @@ -177,17 +173,17 @@ export default class ActivityCalendar { return `translate(${this.daySizeWithSpace * i + 1 + this.daySizeWithSpace}, 18)`; }) .selectAll('rect') - .data(stamp => stamp) + .data((stamp) => stamp) .enter() .append('rect') .attr('x', '0') - .attr('y', stamp => this.dayYPos(stamp.day)) + .attr('y', (stamp) => this.dayYPos(stamp.day)) .attr('width', this.daySize) .attr('height', this.daySize) - .attr('fill', stamp => + .attr('fill', (stamp) => stamp.count !== 0 ? this.color(Math.min(stamp.count, 40)) : '#ededed', ) - .attr('title', stamp => formatTooltipText(stamp)) + .attr('title', (stamp) => formatTooltipText(stamp)) .attr('class', 'user-contrib-cell has-tooltip') .attr('data-html', true) .attr('data-container', 'body') @@ -230,8 +226,8 @@ export default class ActivityCalendar { .append('text') .attr('text-anchor', 'middle') .attr('x', 8) - .attr('y', day => day.y) - .text(day => day.text) + .attr('y', (day) => day.y) + .text((day) => day.text) .attr('class', 'user-contrib-text'); } @@ -243,10 +239,10 @@ export default class ActivityCalendar { .data(this.months) .enter() .append('text') - .attr('x', date => date.x) + .attr('x', (date) => date.x) .attr('y', 10) .attr('class', 'user-contrib-text') - .text(date => this.monthNames[date.month]); + .text((date) => this.monthNames[date.month]); } renderKey() { @@ -276,7 +272,7 @@ export default class ActivityCalendar { .attr('height', this.daySize) .attr('x', (color, i) => this.daySizeWithSpace * i) .attr('y', 0) - .attr('fill', color => color) + .attr('fill', (color) => color) .attr('class', 'has-tooltip') .attr('title', (color, i) => keyValues[i]) .attr('data-container', 'body') @@ -291,10 +287,7 @@ export default class ActivityCalendar { this.colorKey(2), this.colorKey(3), ]; - return d3 - .scaleThreshold() - .domain([0, 10, 20, 30]) - .range(colorRange); + return d3.scaleThreshold().domain([0, 10, 20, 30]).range(colorRange); } clickDay(stamp) { diff --git a/app/assets/javascripts/pages/users/index.js b/app/assets/javascripts/pages/users/index.js index 8adbc2a8168..b22287a0093 100644 --- a/app/assets/javascripts/pages/users/index.js +++ b/app/assets/javascripts/pages/users/index.js @@ -8,12 +8,10 @@ function initUserProfile(action) { new UserTabs({ parentEl: '.user-profile', action }); // hide project limit message - $('.hide-project-limit-message').on('click', e => { + $('.hide-project-limit-message').on('click', (e) => { e.preventDefault(); Cookies.set('hide_project_limit_message', 'false'); - $(this) - .parents('.project-limit-message') - .remove(); + $(this).parents('.project-limit-message').remove(); }); } diff --git a/app/assets/javascripts/pages/users/user_tabs.js b/app/assets/javascripts/pages/users/user_tabs.js index 2485853afc7..7c88aa53e4b 100644 --- a/app/assets/javascripts/pages/users/user_tabs.js +++ b/app/assets/javascripts/pages/users/user_tabs.js @@ -100,8 +100,8 @@ export default class UserTabs { bindEvents() { this.$parentEl .off('shown.bs.tab', '.nav-links a[data-toggle="tab"]') - .on('shown.bs.tab', '.nav-links a[data-toggle="tab"]', event => this.tabShown(event)) - .on('click', '.gl-pagination a', event => this.changeProjectsPage(event)); + .on('shown.bs.tab', '.nav-links a[data-toggle="tab"]', (event) => this.tabShown(event)) + .on('click', '.gl-pagination a', (event) => this.changeProjectsPage(event)); window.addEventListener('resize', () => this.onResize()); } @@ -212,17 +212,19 @@ export default class UserTabs { const calendarPath = $calendarWrap.data('calendarPath'); AjaxCache.retrieve(calendarPath) - .then(data => UserTabs.renderActivityCalendar(data, $calendarWrap)) + .then((data) => UserTabs.renderActivityCalendar(data, $calendarWrap)) .catch(() => { const cWrap = $calendarWrap[0]; cWrap.querySelector('.spinner').classList.add('invisible'); cWrap.querySelector('.user-calendar-error').classList.remove('invisible'); - cWrap.querySelector('.user-calendar-error .js-retry-load').addEventListener('click', e => { - e.preventDefault(); - cWrap.querySelector('.user-calendar-error').classList.add('invisible'); - cWrap.querySelector('.spinner').classList.remove('invisible'); - this.loadActivityCalendar(); - }); + cWrap + .querySelector('.user-calendar-error .js-retry-load') + .addEventListener('click', (e) => { + e.preventDefault(); + cWrap.querySelector('.user-calendar-error').classList.add('invisible'); + cWrap.querySelector('.spinner').classList.remove('invisible'); + this.loadActivityCalendar(); + }); }); } |