2013-01-10 16:38:37 +01:00
|
|
|
window.dashboardPage = ->
|
2013-01-09 20:28:31 +01:00
|
|
|
Pager.init 20, true
|
2013-03-10 10:57:14 +01:00
|
|
|
initSidebarTab()
|
2013-01-09 22:02:41 +01:00
|
|
|
$(".event_filter_link").bind "click", (event) ->
|
|
|
|
event.preventDefault()
|
2013-01-09 20:28:31 +01:00
|
|
|
toggleFilter $(this)
|
|
|
|
reloadActivities()
|
2013-01-23 17:43:23 +01:00
|
|
|
|
2013-01-09 20:28:31 +01:00
|
|
|
reloadActivities = ->
|
|
|
|
$(".content_list").html ''
|
|
|
|
Pager.init 20, true
|
2013-01-23 17:43:23 +01:00
|
|
|
|
2013-01-09 20:28:31 +01:00
|
|
|
toggleFilter = (sender) ->
|
|
|
|
sender.parent().toggleClass "inactive"
|
|
|
|
event_filters = $.cookie("event_filter")
|
|
|
|
filter = sender.attr("id").split("_")[0]
|
|
|
|
if event_filters
|
|
|
|
event_filters = event_filters.split(",")
|
|
|
|
else
|
|
|
|
event_filters = new Array()
|
2013-01-23 17:43:23 +01:00
|
|
|
|
2013-01-09 20:28:31 +01:00
|
|
|
index = event_filters.indexOf(filter)
|
|
|
|
if index is -1
|
|
|
|
event_filters.push filter
|
|
|
|
else
|
|
|
|
event_filters.splice index, 1
|
2013-01-23 17:43:23 +01:00
|
|
|
|
2013-01-09 20:28:31 +01:00
|
|
|
$.cookie "event_filter", event_filters.join(",")
|
2013-03-10 10:57:14 +01:00
|
|
|
|
|
|
|
initSidebarTab = ->
|
|
|
|
key = "dashboard_sidebar_filter"
|
|
|
|
|
|
|
|
# store selection in cookie
|
|
|
|
$('.dash-sidebar-tabs a').on 'click', (e) ->
|
|
|
|
$.cookie(key, $(e.target).attr('id'))
|
|
|
|
|
|
|
|
# show tab from cookie
|
|
|
|
sidebar_filter = $.cookie(key)
|
|
|
|
$("#" + sidebar_filter).tab('show') if sidebar_filter
|