Skip to content

Commit

Permalink
Fixed cookie management. Please clear cookies before retesting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Pascoe authored and Stephen Pascoe committed Sep 15, 2015
1 parent 7958bb4 commit 514ac31
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions luigi/static/visualiser/js/visualiserApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,17 @@ function visualiserApp(luigi) {
};

function getVisType() {
if (document.cookie === "") {
var cookieParts = document.cookie.match(/visType=(.*)/);
if (cookieParts === null) {
return 'svg';
}
else {
var cookieObj = JSON.parse(document.cookie);
return cookieObj.visType;
return cookieParts[1];
}
}
function setVisType (newVisType) {
var cookieObj;
visType = newVisType;
if (document.cookie === "") {
cookieObj = {};
}
else {
var cookieObj = JSON.parse(document.cookie);
}
cookieObj.visType = newVisType;
document.cookie = JSON.stringify(cookieObj);
document.cookie = 'visType=' + visType;

$('#toggleVisButtons').find('label').removeClass('active');
$('#toggleVisButtons').find('input[value="' + visType + '"]').parent().addClass('active');
Expand Down

0 comments on commit 514ac31

Please sign in to comment.