Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE- UCSFD8 -1372 OneTrust Cookie Banner #720

Draft
wants to merge 30 commits into
base: release
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2b1f540
added OneTrust code to the bottom though commented for the moment
langNguyenUCSF Feb 27, 2024
21939f3
Updated OT banner config
langNguyenUCSF Feb 29, 2024
8f2d3e7
Updated OT Config
langNguyenUCSF Feb 29, 2024
e60816b
Merge branch 'UCSFD8-1372' of github.com:ucsf-web-services/ucsf_8_pa …
sashazm Mar 7, 2024
3dd01fb
style changes based on feedback
sashazm Mar 7, 2024
8e0b063
debugging site build
sashazm Mar 7, 2024
af2eb2f
debugging
sashazm Mar 7, 2024
c0f9569
debugging
sashazm Mar 7, 2024
14f3024
Revert "debugging"
sashazm Mar 7, 2024
5bf2918
Revert "debugging"
sashazm Mar 7, 2024
bd694e4
Merge pull request #722 from ucsf-web-services/UCSFD8-1372-test
sashazm Mar 7, 2024
87e9c8d
test update
sashazm Mar 7, 2024
5537272
even out the spacing on top and bottom of the modal text
sashazm Mar 7, 2024
2fa67fd
even space on the text
sashazm Mar 7, 2024
890b455
styling cookie banner
sashazm Mar 7, 2024
a9f27db
overwriting outline color
sashazm Mar 11, 2024
872fdb0
refactoring css to make it cleaner
sashazm Mar 11, 2024
79998d1
spacing and border color update
sashazm Mar 11, 2024
468987f
one more attempt at changing outline color
sashazm Mar 11, 2024
3746d0b
debugging color for outline
sashazm Mar 12, 2024
fa8275c
back to #9ba6b6 for gray outline
sashazm Mar 12, 2024
8ce9335
adding onetrust aria labels and targets to links
sashazm Mar 13, 2024
37b2dd1
onetrust banner small screen styles
sashazm Mar 13, 2024
921b9b8
fixing link space
sashazm Mar 13, 2024
5be2418
debug environmet
sashazm Mar 13, 2024
f525169
Merge branch 'release' into UCSFD8-1372
sashazm Mar 20, 2024
6bd5af2
testing if patches causing environment to not build
sashazm Mar 21, 2024
477518c
setting composer back the way it was. adding array around exposed hea…
sashazm Mar 21, 2024
5bd909d
adding some padding when banner goes to 2 col
sashazm Mar 21, 2024
3887873
bug fix
sashazm Mar 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docroot/sites/default/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ parameters:
# Configure requests allowed from specific origins.
allowedOrigins: ['*']
# Sets the Access-Control-Expose-Headers header.
exposedHeaders: true
exposedHeaders: [true]
# Sets the Access-Control-Max-Age header.
maxAge: false
# Sets the Access-Control-Allow-Credentials header.
Expand Down
44 changes: 44 additions & 0 deletions docroot/themes/custom/ucsf/dist/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions docroot/themes/custom/ucsf/js/ucsf_onetrust_baner_tweaks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
(function(Drupal, once) {

Drupal.behaviors.oneTrust = {
attach: function(context) {
const delayInMilliseconds = 1000; //1 second

setTimeout(function() {
// Hack to satisfy client requirements for this ticket:
// https://ucsfredesign.atlassian.net/browse/UCSFD8-1372
const oneTrustBannerTextLoaded= once('oneTrust', '#onetrust-banner-sdk', context).shift();
if (!oneTrustBannerTextLoaded) {
return;
}
const oneTrustBannerText = document.querySelector('#onetrust-policy-text');
// for each link force to open in same tab
const bannerLinks = oneTrustBannerText.querySelectorAll('a');
bannerLinks.forEach(link => {
link.setAttribute('target', '_self');
link.removeAttribute('rel');
});

// One trust just adds aria-label to firs link it finds,
// but in our usecase first link is not the privacy policy link
// so we need to take that label and append it to the link where it belongs.
const privacyAriaLabel = oneTrustBannerText.querySelector("[aria-label*='privacy']").ariaLabel.replace('opens in a new tab', 'opens in the same tab');
const privacyLink = oneTrustBannerText.querySelector("[href*='privacy']");
privacyLink.ariaLabel = privacyAriaLabel;
// get the current aria label provided through OneTrust UI, replace the tab behavior text.
oneTrustBannerText.querySelector("[href*='terms-of-use']").ariaLabel = "More information about UCSF terms of use, opens in the same tab";


}, delayInMilliseconds);

}
}

})(Drupal, once);

44 changes: 44 additions & 0 deletions docroot/themes/custom/ucsf/scss/1_global/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -508,3 +508,47 @@ a[name] {
display: block;
}
}

// Onetrust cookie banner
#onetrust-banner-sdk {
box-shadow: -3px 0px 3px 0px rgba(0,0,0,0.2) !important;
#onetrust-policy {
margin: 1.25em 0 1.25em 2em !important;

@media ($below-s) {
margin: 1.25em 0 1.25em 0 !important;
}
}
#onetrust-consent-sdk &:focus {
outline: 1px solid #9ba6b6 !important;
}
&:not(.ot-iab-2) #onetrust-group-container {
@media ($below-s) {
width: 100% !important;
}
}
.ot-sdk-container {
@media ($below-s) {
position: relative !important;
width: 100% !important;
max-width: 100% !important;
margin: 0 auto !important;
padding: 0 20px !important;
}
}
.has-reject-all-button #onetrust-button-group {
@media ($below-s) {
float: none !important;
width: 100% !important;
}
}
& #onetrust-policy-text a:first-of-type {
margin-left: 0 !important;
}
}

#onetrust-banner-sdk:not(.ot-iab-2) #onetrust-button-group-parent {
@media (min-width: 1024px) and (max-width: 1280px) {
padding-left: 1rem;
}
}
7 changes: 7 additions & 0 deletions docroot/themes/custom/ucsf/templates/html/html.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
{% endif %}
<js-bottom-placeholder token="{{ placeholder_token }}">
<script type="text/javascript">

/*<![CDATA[*/
(function() {
var sz = document.createElement('script'); sz.type = 'text/javascript'; sz.async = true;
Expand All @@ -74,5 +75,11 @@
})();
/*]]>*/
</script>

<!-- OneTrust Cookies Consent Notice start for www.ucsf.ed -->
<script src="https://cdn.cookielaw.org/consent/5be9f575-9cac-4305-8c58-7ded94d757c3-test/otSDKStub.js" type="text/javascript" charset="UTF-8" data-domain-script="5be9f575-9cac-4305-8c58-7ded94d757c3-test" ></script>
<script type="text/javascript">
function OptanonWrapper() { }
</script>
</body>
</html>
2 changes: 2 additions & 0 deletions docroot/themes/custom/ucsf/ucsf.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ global:
js/ucsf_element_slide.js: {}
js/ucsf_main_menu.js: {}
js/ucsf_sticky_nav.js: {}
js/ucsf_onetrust_baner_tweaks.js: {}
https://kit.fontawesome.com/0047baebb3.js: { type: external, attributes: { crossorigin: anonymous }}
dependencies:
- core/drupal
- ucsf/polyfills
- core/once
- core/loadjs
Expand Down