2014-10-20 16:48:07 -04:00
|
|
|
class @Activities
|
2013-08-26 09:30:03 -04:00
|
|
|
constructor: ->
|
2016-06-09 13:31:18 -04:00
|
|
|
Pager.init 20, true, false, @updateTooltips
|
2016-02-23 12:28:12 -05:00
|
|
|
$(".event-filter-link").on "click", (event) =>
|
2013-08-26 09:30:03 -04:00
|
|
|
event.preventDefault()
|
|
|
|
@toggleFilter($(event.currentTarget))
|
|
|
|
@reloadActivities()
|
|
|
|
|
2016-06-09 13:31:18 -04:00
|
|
|
updateTooltips: ->
|
2016-05-24 19:40:27 -04:00
|
|
|
gl.utils.localTimeAgo($('.js-timeago', '#activity'))
|
|
|
|
|
2013-08-26 09:30:03 -04:00
|
|
|
reloadActivities: ->
|
|
|
|
$(".content_list").html ''
|
|
|
|
Pager.init 20, true
|
|
|
|
|
|
|
|
|
|
|
|
toggleFilter: (sender) ->
|
2016-02-23 08:29:36 -05:00
|
|
|
$('.event-filter .active').removeClass "active"
|
2013-08-26 09:30:03 -04:00
|
|
|
event_filters = $.cookie("event_filter")
|
|
|
|
filter = sender.attr("id").split("_")[0]
|
2016-02-23 08:29:36 -05:00
|
|
|
$.cookie "event_filter", (if event_filters isnt filter then filter else ""), { path: '/' }
|
2013-08-26 09:30:03 -04:00
|
|
|
|
2016-02-23 08:29:36 -05:00
|
|
|
if event_filters isnt filter
|
|
|
|
sender.closest('li').toggleClass "active"
|