Commit bef5695a authored by Phil Hughes's avatar Phil Hughes

Formats tooltip title & date correctly

Correctly changes the activity when clicking a date - will also revert back to old data when clicking date again
parent 1c9440c2
class @Calendar class @Calendar
constructor: (timestamps, calendar_activities_path) -> constructor: (timestamps, calendar_activities_path) ->
currentSelectedDate = ''
# Get the highest value from the timestampes # Get the highest value from the timestampes
highestValue = 0 highestValue = 0
_.each timestamps, (count) -> _.each timestamps, (count) ->
...@@ -89,7 +90,14 @@ class @Calendar ...@@ -89,7 +90,14 @@ class @Calendar
.attr 'width', 15 .attr 'width', 15
.attr 'height', 15 .attr 'height', 15
.attr 'title', (stamp) -> .attr 'title', (stamp) ->
"#{stamp.count} contributions<br />#{gl.utils.formatDate stamp.date}" contribText = 'No contributions'
if stamp.count > 0
contribText = "#{stamp.count} contribution#{if stamp.count > 1 then 's' else ''}"
date = dateFormat(stamp.date, 'mmm d, yyyy')
"#{contribText}<br />#{date}"
.attr 'class', 'user-contrib-cell js-tooltip' .attr 'class', 'user-contrib-cell js-tooltip'
.attr 'fill', (stamp) -> .attr 'fill', (stamp) ->
if stamp.count isnt 0 if stamp.count isnt 0
...@@ -98,16 +106,22 @@ class @Calendar ...@@ -98,16 +106,22 @@ class @Calendar
'#ededed' '#ededed'
.attr 'data-container', 'body' .attr 'data-container', 'body'
.on 'click', (stamp) -> .on 'click', (stamp) ->
date = stamp.date if currentSelectedDate is ''
formated_date = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate() currentSelectedDate = stamp.date
$.ajax formated_date = currentSelectedDate.getFullYear() + "-" + (currentSelectedDate.getMonth()+1) + "-" + currentSelectedDate.getDate()
url: calendar_activities_path
data: $.ajax
date: formated_date url: calendar_activities_path
cache: false data:
dataType: "html" date: formated_date
success: (data) -> cache: false
$(".user-calendar-activities").html data dataType: 'html'
success: (data) ->
$('.user-calendar-activities').html data
else
currentSelectedDate = ''
$('.user-calendar-activities, .content_list').html ''
Pager.getOld()
# Month titles # Month titles
svg.append 'g' svg.append 'g'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment