2015-03-26 01:22:10 -04:00
|
|
|
class @Calendar
|
2015-03-13 06:39:26 -04:00
|
|
|
constructor: (timestamps, starting_year, starting_month, calendar_activities_path) ->
|
2015-01-28 16:18:22 -05:00
|
|
|
cal = new CalHeatMap()
|
|
|
|
cal.init
|
2015-03-22 02:48:08 -04:00
|
|
|
itemName: ["contribution"]
|
2015-01-28 16:18:22 -05:00
|
|
|
data: timestamps
|
|
|
|
start: new Date(starting_year, starting_month)
|
|
|
|
domainLabelFormat: "%b"
|
|
|
|
id: "cal-heatmap"
|
|
|
|
domain: "month"
|
|
|
|
subDomain: "day"
|
|
|
|
range: 12
|
|
|
|
tooltip: true
|
|
|
|
label:
|
|
|
|
position: "top"
|
|
|
|
legend: [
|
|
|
|
0
|
2015-03-30 22:50:10 -04:00
|
|
|
10
|
|
|
|
20
|
2015-03-30 22:57:36 -04:00
|
|
|
30
|
2015-01-28 16:18:22 -05:00
|
|
|
]
|
|
|
|
legendCellPadding: 3
|
2015-11-04 08:13:25 -05:00
|
|
|
cellSize: $('.user-calendar').width() / 73
|
2015-01-28 16:18:22 -05:00
|
|
|
onClick: (date, count) ->
|
2015-03-13 06:39:26 -04:00
|
|
|
formated_date = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate()
|
|
|
|
$.ajax
|
|
|
|
url: calendar_activities_path
|
|
|
|
data:
|
|
|
|
date: formated_date
|
|
|
|
cache: false
|
|
|
|
dataType: "html"
|
|
|
|
success: (data) ->
|
|
|
|
$(".user-calendar-activities").html data
|
|
|
|
|