Event filters stores at cookies.
This commit is contained in:
parent
b255c3c44b
commit
97d17cf835
6 changed files with 56 additions and 11 deletions
27
app/assets/javascripts/dashboard.js
Normal file
27
app/assets/javascripts/dashboard.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Init dashboard page
|
||||
*
|
||||
*/
|
||||
function dashboardPage(){
|
||||
$(".event_filter_link").bind('click',(function(){
|
||||
enableFilter(this.id);
|
||||
}));
|
||||
}
|
||||
|
||||
function enableFilter(sender_id){
|
||||
var event_filters = $.cookie('event_filter');
|
||||
var filter = sender_id.split('_')[0];
|
||||
if (!event_filters) {
|
||||
event_filters = new Array();
|
||||
} else {
|
||||
event_filters = event_filters.split(',');
|
||||
}
|
||||
var index = event_filters.indexOf(filter);
|
||||
if (index == -1) {
|
||||
event_filters.push(filter);
|
||||
} else {
|
||||
event_filters.splice(index, 1);
|
||||
}
|
||||
$.cookie('event_filter', event_filters.join(','));
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue