From cf78976d00316e0d2b333e7c8ee53b84d8df18f5 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Wed, 21 Dec 2016 12:37:39 +0100 Subject: [PATCH 1/2] nothing --- rowers/templates/base.html | 7 +++---- rowsandall_app/settings.py | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rowers/templates/base.html b/rowers/templates/base.html index a45eaa3a..5bdb15a0 100644 --- a/rowers/templates/base.html +++ b/rowers/templates/base.html @@ -5,7 +5,6 @@ {% analytical_head_top %} - @@ -20,7 +19,7 @@ {% analytical_head_bottom %} - {% analytical_body_top %} + {% analytical_body_top %}
{% endblock %}
- - + + {% analytical_body_bottom %} diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index f2226e93..90bdda75 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -282,3 +282,4 @@ REST_FRAMEWORK = { # Analytics CLICKY_SITE_ID = '101011008' + From a03848e568dbbc7978ce39c35e8f6a560da7ed3e Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Wed, 21 Dec 2016 13:14:08 +0100 Subject: [PATCH 2/2] Added cookie law banner --- rowers/templates/base.html | 4 ++++ rowsandall_app/settings.py | 4 ++++ static/cookielaw/css/cookielaw.css | 19 +++++++++++++++++++ static/cookielaw/img/close.png | Bin 0 -> 190 bytes static/cookielaw/js/cookielaw.js | 25 +++++++++++++++++++++++++ 5 files changed, 52 insertions(+) create mode 100644 static/cookielaw/css/cookielaw.css create mode 100644 static/cookielaw/img/close.png create mode 100644 static/cookielaw/js/cookielaw.js diff --git a/rowers/templates/base.html b/rowers/templates/base.html index a45eaa3a..aa59cd8d 100644 --- a/rowers/templates/base.html +++ b/rowers/templates/base.html @@ -1,7 +1,9 @@ +{% load cookielaw_tags %} {% load analytical %} + {% analytical_head_top %} @@ -16,6 +18,7 @@ + {% block meta %} {% endblock %} {% analytical_head_bottom %} @@ -180,6 +183,7 @@ {% endblock %} + {% cookielaw_banner %} {% analytical_body_bottom %} diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index f2226e93..bf0a2e9e 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -52,6 +52,7 @@ INSTALLED_APPS = [ 'oauth2_provider', 'corsheaders', 'analytical', + 'cookielaw' ] AUTHENTICATION_BACKENDS = ( @@ -282,3 +283,6 @@ REST_FRAMEWORK = { # Analytics CLICKY_SITE_ID = '101011008' + +# Cookie Law + diff --git a/static/cookielaw/css/cookielaw.css b/static/cookielaw/css/cookielaw.css new file mode 100644 index 00000000..5e76378e --- /dev/null +++ b/static/cookielaw/css/cookielaw.css @@ -0,0 +1,19 @@ +#CookielawBanner { + background: #fff; + padding: 15px 0; +} + +#CookielawBanner .container { + position: relative; +} + +#CookielawBanner #CookielawCross { + background: url('../img/close.png') no-repeat 0 0; + cursor: pointer; + display: block; + position: absolute; + top: 0; + right: 0; + width: 15px; + height: 15px; +} diff --git a/static/cookielaw/img/close.png b/static/cookielaw/img/close.png new file mode 100644 index 0000000000000000000000000000000000000000..839576e6cc0e571974b6a5e2fc0cc42727e41ea3 GIT binary patch literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^{2`|NoyCDSmp=BdNp`^3W-wBtI~=NvQXTUGx&Q?z6gV?UMhl6nAXxf5ykNT7}*#m8Z%nF*LZgpXeNWFtDnm{r-UW|5Bx)h literal 0 HcmV?d00001 diff --git a/static/cookielaw/js/cookielaw.js b/static/cookielaw/js/cookielaw.js new file mode 100644 index 00000000..17ffc342 --- /dev/null +++ b/static/cookielaw/js/cookielaw.js @@ -0,0 +1,25 @@ +var Cookielaw = { + + createCookie: function (name, value, days) { + var date = new Date(), + expires = ''; + if (days) { + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + expires = "; expires=" + date.toGMTString(); + } else { + expires = ""; + } + document.cookie = name + "=" + value + expires + "; path=/"; + }, + + createCookielawCookie: function () { + this.createCookie('cookielaw_accepted', '1', 10 * 365); + + if (typeof (window.jQuery) === 'function') { + jQuery('#CookielawBanner').slideUp(); + } else { + document.getElementById('CookielawBanner').style.display = 'none'; + } + } + +};