BigW Consortium Gitlab

activities.js.coffee 741 Bytes
Newer Older
1
class @Activities
2
  constructor: ->
3
    Pager.init 20, true, false, @updateTooltips
4
    $(".event-filter-link").on "click", (event) =>
5 6 7 8
      event.preventDefault()
      @toggleFilter($(event.currentTarget))
      @reloadActivities()

9
  updateTooltips: ->
10 11
    gl.utils.localTimeAgo($('.js-timeago', '#activity'))

12 13 14 15 16 17
  reloadActivities: ->
    $(".content_list").html ''
    Pager.init 20, true


  toggleFilter: (sender) ->
18
    $('.event-filter .active').removeClass "active"
19 20
    event_filters = $.cookie("event_filter")
    filter = sender.attr("id").split("_")[0]
21
    $.cookie "event_filter", (if event_filters isnt filter then filter else ""), { path: '/' }
22

23 24
    if event_filters isnt filter
      sender.closest('li').toggleClass "active"