Commit ae9c6869 by lidijarad

cookie consent feature flag and popup banner

parent 19d6e21a
......@@ -367,6 +367,10 @@ FEATURES = {
# Allow public account creation
'ALLOW_PUBLIC_ACCOUNT_CREATION': True,
# Enable footer banner for cookie consent.
# See https://cookieconsent.insites.com/ for more.
'ENABLE_COOKIE_CONSENT': False,
}
# Ignore static asset files on import which match this pattern
......
......@@ -83,3 +83,7 @@
<link rel="stylesheet" type="text/css" href="${url}"></link>
% endfor
% endif
% if settings.FEATURES.get('ENABLE_COOKIE_CONSENT', False):
<%include file="widgets/cookie-consent.html" />
% endif
<!-- Cookie Consent -->
<%page expression_filter="h"/>
<%! from django.utils.translation import ugettext as _ %>
<%namespace name='static' file='../static_content.html'/>
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.1/cookieconsent.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.1/cookieconsent.min.js"></script>
<script>
window.addEventListener("load", function(){
window.cookieconsent.initialise({
window: '<div dir="${static.dir_rtl()}" role="dialog" tabindex="-1" id="cookiepopup" aria-label="cookieconsent" class="cc-window {{classes}}"><!--googleoff: all-->{{children}}<!--googleon: all--></div>',
palette:{
popup: {background: "#323538", text: "#ffffff"},
button: {background: "#005379", text: "#ffffff"},
},
"content": {
"message": "${_('This website uses cookies to ensure you get the best experience on our website.')}",
"dismiss": "${_('Got it!')}",
"link": "${_('Learn more')}",
},
theme: "classic",
"elements": {
"dismiss": '<a aria-label="dismiss cookie message" id="dismiss" role=button tabindex="2" class="cc-btn cc-dismiss:focus">{{dismiss}}</a>',
},
"position": "bottom",
"static": "true"
},
function(popup){
$(".cc-window").on('keydown', function(event) {
if (event.keyCode == 27 ){
popup.close();
}
});
$("#dismiss").on('keydown', function(event) {
if (event.keyCode == 13 || event.keyCode == 32 ) {
popup.onButtonClick(event);
}
});
});
});
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment