From a54188870c6b8e8359608d26863e6bd9d1bf1945 Mon Sep 17 00:00:00 2001 From: Yuki Sato Date: Thu, 6 Dec 2018 11:06:57 +0100 Subject: [PATCH 1/3] added expire date for cookie banner --- src/components/cookies-banner/cookies-banner.directive.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/cookies-banner/cookies-banner.directive.js b/src/components/cookies-banner/cookies-banner.directive.js index 9e836d22b..c6db93423 100644 --- a/src/components/cookies-banner/cookies-banner.directive.js +++ b/src/components/cookies-banner/cookies-banner.directive.js @@ -20,9 +20,13 @@ const directiveCtrl = ($scope, $cookies) => { $scope.visible = true; const cookieKey = 'cookiesBannerConfirmed'; + // setting expireDate to 2 years ahead + const expireDate = new Date(); + expireDate.setDate(expireDate.getDate() + 730); + $scope.clicked = () => { $scope.visible = false; - $cookies.put(cookieKey, 'true'); + $cookies.put(cookieKey, 'true', { 'expires': expireDate }); }; const result = $cookies.get(cookieKey); From be604e17a9889767839b2c3ca89c28b2a5bf4bc5 Mon Sep 17 00:00:00 2001 From: Yuki Sato Date: Thu, 6 Dec 2018 11:25:23 +0100 Subject: [PATCH 2/3] modified --- src/components/cookies-banner/cookies-banner.directive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/cookies-banner/cookies-banner.directive.js b/src/components/cookies-banner/cookies-banner.directive.js index c6db93423..fbe6cb644 100644 --- a/src/components/cookies-banner/cookies-banner.directive.js +++ b/src/components/cookies-banner/cookies-banner.directive.js @@ -20,7 +20,7 @@ const directiveCtrl = ($scope, $cookies) => { $scope.visible = true; const cookieKey = 'cookiesBannerConfirmed'; - // setting expireDate to 2 years ahead + // setting the expiredate to 2years ahead const expireDate = new Date(); expireDate.setDate(expireDate.getDate() + 730); From 3c57a3fc451491f7381ec7565f66213c6a633992 Mon Sep 17 00:00:00 2001 From: Yuki Sato Date: Fri, 7 Dec 2018 11:04:36 +0100 Subject: [PATCH 3/3] added const for expiring days and modified syntax --- src/app/app.js | 1 - src/components/cookies-banner/cookies-banner.directive.js | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/app.js b/src/app/app.js index 11cd775a0..14fc9cb02 100644 --- a/src/app/app.js +++ b/src/app/app.js @@ -26,7 +26,6 @@ import 'angular-cookies'; // styles import 'amstock3/amcharts/style.css'; import 'bootstrap/dist/css/bootstrap.css'; -import 'font-awesome/css/font-awesome.css'; import 'leaflet/dist/leaflet.css'; import 'leaflet.markercluster/dist/MarkerCluster.Default.css'; import 'angular-advanced-searchbox/dist/angular-advanced-searchbox.min.css'; diff --git a/src/components/cookies-banner/cookies-banner.directive.js b/src/components/cookies-banner/cookies-banner.directive.js index fbe6cb644..f72ee5f61 100644 --- a/src/components/cookies-banner/cookies-banner.directive.js +++ b/src/components/cookies-banner/cookies-banner.directive.js @@ -22,11 +22,12 @@ const directiveCtrl = ($scope, $cookies) => { // setting the expiredate to 2years ahead const expireDate = new Date(); - expireDate.setDate(expireDate.getDate() + 730); + const expireDays = 365 * 2; + expireDate.setDate(expireDate.getDate() + expireDays); $scope.clicked = () => { $scope.visible = false; - $cookies.put(cookieKey, 'true', { 'expires': expireDate }); + $cookies.put(cookieKey, 'true', { expires: expireDate }); }; const result = $cookies.get(cookieKey);