Skip to content

Commit

Permalink
Cookie banner: only show in GDPR countries
Browse files Browse the repository at this point in the history
This was made possible in Pegasus by #26753.
  • Loading branch information
breville committed Feb 7, 2019
1 parent c845e62 commit 4605f79
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions shared/haml/cookie_banner.haml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
%link{rel:'stylesheet', type:'text/css', href:'/shared/css/cookie-banner.css'}
%script{src: minifiable_asset_path("js/cookieBanner.js")}
- if request.gdpr?
%link{rel:'stylesheet', type:'text/css', href:'/shared/css/cookie-banner.css'}
%script{src: minifiable_asset_path("js/cookieBanner.js")}

-# dashboard is passed as a parameter when the dashboard is rendering this banner.
- dashboard ||= false
- if dashboard
- message = I18n.t('cookie_banner.message')
- more_information = I18n.t('cookie_banner.more_information')
- accept = I18n.t('cookie_banner.accept')
- else
- message = hoc_s(:cookie_banner_message)
- more_information = hoc_s(:cookie_banner_more_information)
- accept = hoc_s(:cookie_banner_accept)
-# dashboard is passed as a parameter when the dashboard is rendering this banner.
- dashboard ||= false
- if dashboard
- message = I18n.t('cookie_banner.message')
- more_information = I18n.t('cookie_banner.more_information')
- accept = I18n.t('cookie_banner.accept')
- else
- message = hoc_s(:cookie_banner_message)
- more_information = hoc_s(:cookie_banner_more_information)
- accept = hoc_s(:cookie_banner_accept)

#cookie-banner{style: "display: none"}
.text
= message
%a{href: CDO.code_org_url('/privacy'), target: '_blank'}= more_information
#cookie-banner{style: "display: none"}
.text
= message
%a{href: CDO.code_org_url('/privacy'), target: '_blank'}= more_information

.buttons
%button#accept-cookies= accept
.buttons
%button#accept-cookies= accept

:javascript
// When loaded on the code.org homepage, jQuery is not yet available (since its
// load is deferred), but a shim implementing .ready() is available.
$(document).ready(function() {
window.setupCookieBanner("#{rack_env}");
});
:javascript
// When loaded on the code.org homepage, jQuery is not yet available (since its
// load is deferred), but a shim implementing .ready() is available.
$(document).ready(function() {
window.setupCookieBanner("#{rack_env}");
});

0 comments on commit 4605f79

Please sign in to comment.