diff --git a/rowers/templates/base.html b/rowers/templates/base.html index a45eaa3a..ed06f76e 100644 --- a/rowers/templates/base.html +++ b/rowers/templates/base.html @@ -1,11 +1,12 @@ +{% load cookielaw_tags %} {% load analytical %} + {% analytical_head_top %} - @@ -16,11 +17,12 @@ + {% block meta %} {% endblock %} {% analytical_head_bottom %} - {% analytical_body_top %} + {% analytical_body_top %}
{% endblock %}
+ {% cookielaw_banner %} {% analytical_body_bottom %} diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index bf73df04..f59f3c16 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -52,6 +52,7 @@ INSTALLED_APPS = [ 'oauth2_provider', 'corsheaders', 'analytical', + 'cookielaw' ] AUTHENTICATION_BACKENDS = ( 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 00000000..839576e6 Binary files /dev/null and b/static/cookielaw/img/close.png differ 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'; + } + } + +};