-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cookie banner: only show in GDPR countries
This was made possible in Pegasus by #26753.
- Loading branch information
Showing
1 changed file
with
25 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}"); | ||
}); |