BigW Consortium Gitlab

calendar.js.coffee 930 Bytes
Newer Older
1
class @Calendar
2
  constructor: (timestamps, starting_year, starting_month, calendar_activities_path) ->
3 4
    cal = new CalHeatMap()
    cal.init
5
      itemName: ["contribution"]
6 7 8 9 10 11 12 13 14 15 16 17
      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
18 19
        10
        20
20
        30
21 22
      ]
      legendCellPadding: 3
23
      cellSize: $('.user-calendar').width() / 73
24
      onClick: (date, count) ->
25 26 27 28 29 30 31 32 33 34
        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