Allow managing versions of cookies consent
This can be useful when adding a new cookie or making modifications that require asking the user again.
This commit is contained in:
@@ -11,9 +11,13 @@
|
||||
vendors: function() {
|
||||
return $(".cookies-vendors input[type=checkbox]");
|
||||
},
|
||||
cookieName: function() {
|
||||
var versionName = $("#cookies_consent_management").data("version-name");
|
||||
return "cookies_consent_" + versionName;
|
||||
},
|
||||
initialize: function() {
|
||||
$(".accept-all-cookies").on("click", function() {
|
||||
App.Cookies.saveCookie("cookies_consent", "all", 365);
|
||||
App.Cookies.saveCookie(App.CookiesConsent.cookieName(), "all", 365);
|
||||
App.CookiesConsent.vendors().each(function() {
|
||||
App.Cookies.saveCookie(this.name, true, 365);
|
||||
App.CookiesConsent.setCookiesConsent(this.id, true);
|
||||
@@ -22,7 +26,7 @@
|
||||
});
|
||||
|
||||
$(".accept-essential-cookies").on("click", function() {
|
||||
App.Cookies.saveCookie("cookies_consent", "essential", 365);
|
||||
App.Cookies.saveCookie(App.CookiesConsent.cookieName(), "essential", 365);
|
||||
App.CookiesConsent.vendors().each(function() {
|
||||
App.Cookies.saveCookie(this.name, false, 365);
|
||||
App.CookiesConsent.setCookiesConsent(this.id, false);
|
||||
@@ -31,7 +35,7 @@
|
||||
});
|
||||
|
||||
$(".save-cookies-preferences").on("click", function() {
|
||||
App.Cookies.saveCookie("cookies_consent", "custom", 365);
|
||||
App.Cookies.saveCookie(App.CookiesConsent.cookieName(), "custom", 365);
|
||||
App.CookiesConsent.vendors().each(function() {
|
||||
App.Cookies.saveCookie(this.name, this.checked, 365);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user