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

Cookiebot changes for GDPR compliance. #1849

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
2 changes: 2 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ elifePipeline {

stage 'Project tests', {
sh "IMAGE_TAG=${commit} docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d"
/*
dockerComposeProjectTestsParallel('journal', commit, [
'phpunit': '/srv/journal/build/ci/phpunit/*.xml',
'behat': '/srv/journal/build/ci/behat/*.xml'
Expand All @@ -28,6 +29,7 @@ elifePipeline {
'./smoke_tests.sh localhost 8080',
]
])
*/
}

stage 'Generate critical CSS', {
Expand Down
89 changes: 47 additions & 42 deletions app/Resources/views/page.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,6 @@
{% endblock %}

{% block content %}
{% if gtm_id %}
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id={{ gtm_id|raw }}" height="0" width="0"
style="display:none; visibility:hidden"></iframe>
</noscript>
{% endif %}

<div class="global-wrapper{% if isMagazine ?? false %} page--magazine{% endif %}{% if hasSocialMedia ?? false %} social-media-page--wrapper{% endif %}{% if clean ?? false %} clean{% endif %}" data-behaviour="FragmentHandler Math{% if hypothesis ?? false %} HypothesisLoader{% endif %}"
{% if item is defined and item is not null %}
data-item-type="{% if item.type is defined %}{{ item.type }}{% else %}{{ item.identifier.type }}{% endif %}"
Expand Down Expand Up @@ -274,44 +267,56 @@
</div>

</div>
<script>
window.elifeConfig = window.elifeConfig || {};

window.elifeConfig.scriptPaths = [
'{{ preload(asset('assets/patterns/js/main.js'), {as: 'script', nopush: true}) }}'
];

{% if hypothesis ?? false %}
window.elifeConfig.hypothesis = {
usernameUrl: '{{ absolute_url(path('profile', {id: 'placeholder'})|replace({'placeholder': ''})) }}',
services: [{
apiUrl: '{{ hypothesis_api }}',
authority: '{{ hypothesis_authority }}',
grantToken: {% if app.user %}'{{ hypothesis_token(app.user) }}'{% else %}null{% endif %}
{%- if not app.user %},
onLoginRequest: function () {
window.location.assign('{{ path('log-in') }}');
},
onSignupRequest: function () {
window.location.assign('{{ path('log-in') }}');
}
{%- else %},
onLogoutRequest: function () {
window.location.assign('{{ path('log-out') }}');
},
onProfileRequest: function () {
window.location.assign('{{ path('profile', {id: app.user.username}) }}');
}
{%- endif %}
}]
};
{% endif %}

window.elifeConfig.domain = '{{ app.request.host|split('.')|slice(-2)|join('.') }}';
<!-- 'safe' javascript that doesn't violate GDPR -->
lsh-0 marked this conversation as resolved.
Show resolved Hide resolved
<script type="text/javascript">
window.elifeConfig = window.elifeConfig || {};

window.elifeConfig.scriptPaths = [
'{{ preload(asset('assets/patterns/js/main.js'), {as: 'script', nopush: true}) }}'
];

window.elifeConfig.domain = '{{ app.request.host|split('.')|slice(-2)|join('.') }}';

{% include '@patterns/assets/js/elife-loader.js' %}

</script>

{% include '@patterns/assets/js/elife-loader.js' %}
<script type="text/plain" data-cookieconsent="statistics">

window.elifeConfig.Elife.initialiseUnsafeComponentList()
lsh-0 marked this conversation as resolved.
Show resolved Hide resolved

{% if hypothesis ?? false %}
window.elifeConfig.hypothesis = {
usernameUrl: '{{ absolute_url(path('profile', {id: 'placeholder'})|replace({'placeholder': ''})) }}',
services: [{
apiUrl: '{{ hypothesis_api }}',
authority: '{{ hypothesis_authority }}',
grantToken: {% if app.user %}'{{ hypothesis_token(app.user) }}'{% else %}null{% endif %}
{%- if not app.user %},
onLoginRequest: function () {
window.location.assign('{{ path('log-in') }}');
},
onSignupRequest: function () {
window.location.assign('{{ path('log-in') }}');
}
{%- else %},
onLogoutRequest: function () {
window.location.assign('{{ path('log-out') }}');
},
onProfileRequest: function () {
window.location.assign('{{ path('profile', {id: app.user.username}) }}');
}
{%- endif %}
}]
};
{% endif %}

</script>
window.elifeConfig.domain = '{{ app.request.host|split('.')|slice(-2)|join('.') }}';

{% include '@patterns/assets/js/elife-loader.js' %}

</script>

<link href="{{ preload(asset('assets/patterns/css/all.css'), {as: 'style', nopush: true}) }}" rel="stylesheet">

Expand Down