Skip to content

Commit

Permalink
Merge pull request #261 from thorol/addbutton
Browse files Browse the repository at this point in the history
Button "Alles ablehnen"
  • Loading branch information
aeberhard authored Jan 1, 2023
2 parents 104804a + 50099ef commit e71ad81
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 20 deletions.
2 changes: 1 addition & 1 deletion assets/consent_manager_frontend.css

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

33 changes: 19 additions & 14 deletions assets/consent_manager_frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
} else if (el.classList.contains('consent_manager-accept-all')) {
deleteCookies();
saveConsent('all');
} else if (el.classList.contains('consent_manager-accept-none')) {
deleteCookies();
saveConsent('none');
}
if (consent_manager_parameters.hidebodyscrollbar) {
document.querySelector('body').style.overflow = 'auto';
Expand Down Expand Up @@ -112,20 +115,22 @@
cachelogid: consent_manager_parameters.cachelogid
};
// checkboxen
consent_managerBox.querySelectorAll('[data-cookie-uids]').forEach(function (el) {
// array mit cookie uids
var cookieUids = JSON.parse(el.getAttribute('data-cookie-uids'));
if (el.checked || toSave === 'all') {
cookieUids.forEach(function (uid) {
consents.push(uid);
addScript(consent_managerBox.querySelector('[data-uid="script-' + uid + '"]'));
});
} else {
cookieUids.forEach(function (uid) {
removeScript(consent_managerBox.querySelector('[data-uid="script-' + uid + '"]'));
});
}
});
if(toSave !== 'none'){
consent_managerBox.querySelectorAll('[data-cookie-uids]').forEach(function (el) {
// array mit cookie uids
var cookieUids = JSON.parse(el.getAttribute('data-cookie-uids'));
if (el.checked || toSave === 'all') {
cookieUids.forEach(function (uid) {
consents.push(uid);
addScript(consent_managerBox.querySelector('[data-uid="script-' + uid + '"]'));
});
} else {
cookieUids.forEach(function (uid) {
removeScript(consent_managerBox.querySelector('[data-uid="script-' + uid + '"]'));
});
}
});
}
cookieData.consents = consents;
Cookies.set('consent_manager', JSON.stringify(cookieData), { expires: expires, path: '/', domain: consent_manager_parameters.domain, sameSite: 'Lax', secure: false });

Expand Down
1 change: 1 addition & 0 deletions fragments/consent_manager_box.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
</div>
<div class="consent_manager-buttons-sitelinks">
<div class="consent_manager-buttons">
<button tabindex="0" id="consent_manager-accept-none" class="consent_manager-accept-none consent_manager-close"><?= $consent_manager->texts['button_select_none'] ?></button>
<button tabindex="0" id="consent_manager-save-selection" class="consent_manager-save-selection consent_manager-close"><?= $consent_manager->texts['button_accept'] ?></button>
<button tabindex="0" id="consent_manager-accept-all" class="consent_manager-accept-all consent_manager-close"><?= $consent_manager->texts['button_select_all'] ?></button>
</div>
Expand Down
3 changes: 2 additions & 1 deletion install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ INSERT IGNORE INTO `rex_consent_manager_text` (`pid`, `id`, `clang_id`, `uid`, `
(19, 19, 1, 'consent_date', 'Einwilligungsdatum'),
(20, 20, 1, 'consent_id', 'Einwilligungs-ID'),
(21, 21, 1, 'consent_consents', 'Einwilligungen'),
(22, 22, 1, 'edit_consent', 'Cookie Einstellungen bearbeiten');
(22, 22, 1, 'edit_consent', 'Cookie Einstellungen bearbeiten'),
(23, 23, 1, 'button_select_none', 'Alles ablehnen');
8 changes: 5 additions & 3 deletions scss/consent_manager_frontend.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
}
}
.consent_manager-save-selection,
.consent_manager-accept-all {
.consent_manager-accept-all,
.consent_manager-accept-none {
transition: 200ms ease all;
background: #999;
border: 1px solid #444;
Expand All @@ -69,7 +70,7 @@
&:hover {
background: #444;
border-color: #444;
color: #fff;
color: #fff;
text-decoration: none;
}
}
Expand Down Expand Up @@ -201,7 +202,8 @@ a.consent_manager-close, #consent_manager-toggle-details {
}
}
.consent_manager-save-selection,
.consent_manager-accept-all {
.consent_manager-accept-all,
.consent_manager-accept-none {
display: inline-block;
margin: 0 0 0 .5em;
}
Expand Down
3 changes: 2 additions & 1 deletion setup/setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ INSERT INTO `rex_consent_manager_text` (`pid`, `id`, `clang_id`, `uid`, `text`)
(19, 19, 1, 'consent_date', 'Einwilligungsdatum'),
(20, 20, 1, 'consent_id', 'Einwilligungs-ID'),
(21, 21, 1, 'consent_consents', 'Einwilligungen'),
(22, 22, 1, 'edit_consent', 'Cookie Einstellungen bearbeiten');
(22, 22, 1, 'edit_consent', 'Cookie Einstellungen bearbeiten'),
(23, 23, 1, 'button_select_none', 'Alles ablehnen');

0 comments on commit e71ad81

Please sign in to comment.