debian-mirror-gitlab/app/assets/javascripts/activities.js.coffee

25 lines
741 B
CoffeeScript
Raw Normal View History

2015-04-26 12:48:37 +05:30
class @Activities
2014-09-02 18:07:02 +05:30
constructor: ->
Pager.init 20, true, false, @updateTooltips
2016-06-02 11:05:42 +05:30
$(".event-filter-link").on "click", (event) =>
2014-09-02 18:07:02 +05:30
event.preventDefault()
@toggleFilter($(event.currentTarget))
@reloadActivities()
updateTooltips: ->
gl.utils.localTimeAgo($('.js-timeago', '#activity'))
2014-09-02 18:07:02 +05:30
reloadActivities: ->
$(".content_list").html ''
Pager.init 20, true
toggleFilter: (sender) ->
2016-06-02 11:05:42 +05:30
$('.event-filter .active').removeClass "active"
2014-09-02 18:07:02 +05:30
event_filters = $.cookie("event_filter")
filter = sender.attr("id").split("_")[0]
2016-06-02 11:05:42 +05:30
$.cookie "event_filter", (if event_filters isnt filter then filter else ""), { path: '/' }
2014-09-02 18:07:02 +05:30
2016-06-02 11:05:42 +05:30
if event_filters isnt filter
sender.closest('li').toggleClass "active"