diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-07-27 23:35:25 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-07-28 09:27:05 +0300 |
commit | 9d5bdb5d313f42197cfa8c57da314ea423e8d8a1 (patch) | |
tree | 7c8188f178fa3ea12dac96ef4b33709ebca14b1d /app/assets/javascripts/users | |
parent | ce4e891065368901da214b689f929d4cc7ce5b94 (diff) |
resolve prefer-template and quotes eslint violations
Diffstat (limited to 'app/assets/javascripts/users')
-rw-r--r-- | app/assets/javascripts/users/activity_calendar.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/app/assets/javascripts/users/activity_calendar.js b/app/assets/javascripts/users/activity_calendar.js index c345f2ae1ce..79b31227b77 100644 --- a/app/assets/javascripts/users/activity_calendar.js +++ b/app/assets/javascripts/users/activity_calendar.js @@ -1,4 +1,4 @@ -/* eslint-disable no-var, vars-on-top, eqeqeq, newline-per-chained-call, prefer-arrow-callback, consistent-return, one-var, one-var-declaration-per-line, prefer-template, quotes, no-unused-vars, no-else-return, max-len, class-methods-use-this */ +/* eslint-disable no-var, vars-on-top, eqeqeq, newline-per-chained-call, prefer-arrow-callback, consistent-return, one-var, one-var-declaration-per-line, no-unused-vars, no-else-return, max-len, class-methods-use-this */ import d3 from 'd3'; @@ -54,6 +54,7 @@ export default class ActivityCalendar { // Init color functions this.colorKey = this.initColorKey(); this.color = this.initColor(); + // Init the svg element this.renderSvg(group); this.renderDays(); @@ -100,7 +101,7 @@ export default class ActivityCalendar { } } }); - return "translate(" + ((this.daySizeWithSpace * i) + 1 + this.daySizeWithSpace) + ", 18)"; + return `translate(${(this.daySizeWithSpace * i) + 1 + this.daySizeWithSpace}, 18)`; }) .selectAll('rect') .data(stamp => stamp) @@ -115,10 +116,10 @@ export default class ActivityCalendar { date = new Date(stamp.date); contribText = 'No contributions'; if (stamp.count > 0) { - contribText = stamp.count + " contribution" + (stamp.count > 1 ? 's' : ''); + contribText = `${stamp.count} contribution${stamp.count > 1 ? 's' : ''}`; } dateText = date.format('mmm d, yyyy'); - return contribText + "<br />" + (gl.utils.getDayName(date)) + " " + dateText; + return `${contribText}<br />${gl.utils.getDayName(date)} ${dateText}`; }) .attr('class', 'user-contrib-cell js-tooltip').attr('fill', (stamp) => { if (stamp.count !== 0) { @@ -202,8 +203,14 @@ export default class ActivityCalendar { clickDay(stamp) { if (this.currentSelectedDate !== stamp.date) { this.currentSelectedDate = stamp.date; - const date = this.currentSelectedDate.getFullYear() + "-" + (this.currentSelectedDate.getMonth() + 1) + "-" + this.currentSelectedDate.getDate(); - return $.ajax({ + + const date = [ + this.currentSelectedDate.getFullYear(), + this.currentSelectedDate.getMonth() + 1, + this.currentSelectedDate.getDate(), + ].join('-'); + + $.ajax({ url: this.calendarActivitiesPath, data: { date }, cache: false, @@ -213,7 +220,7 @@ export default class ActivityCalendar { }); } else { this.currentSelectedDate = ''; - return $('.user-calendar-activities').html(''); + $('.user-calendar-activities').html(''); } } |