Skip to content

Commit

Permalink
First pass at alert logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mdarnall committed Sep 1, 2012
1 parent f1c2e82 commit 0988e33
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions www/httpdocs/workspace/themes/active/js/alertManager.js
@@ -1,16 +1,28 @@
(function($, window){
"use strict";

$.cookie.json = true;

var alertManager = {
alertCookieName : "alerts",

getHiddenAlerts : function (){
return $.cookie(this.alertCookieName) || [] ;
},
saveHiddenAlerts : function(alerts) {
$.cookie(this.alertCookieName, alerts, { json: true, expires: 365, path : "/" });
},

shouldAlertShow : function (id){
window.console.log('shouldAlertShow');
return true;

var alerts = this.getHiddenAlerts();
return (alerts.indexOf(id) < 0);
},
markAlertHidden : function (id) {
window.console.log('markAlertHidden ' + id);
// todo:
var alerts = this.getHiddenAlerts();
alerts.push(id);
this.saveHiddenAlerts(alerts);
}
};

Expand Down

0 comments on commit 0988e33

Please sign in to comment.