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

fix: remove off days banner #10908

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions templates/web/common/includes/donate_banner.tt.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
}

function DonationButton() {
setBannerCookie('off_donation_banner_2023_a', 1, 180);
setBannerCookie('off_donation_banner_2024_a', 1, 180);
bannerID.style.display = 'none';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
if (getBannerCookie('off_donation_banner_2024_a') !== '') {
bannerID.style.display = 'none';
} else {
bannerID.style.display = 'flex';
Expand Down
5 changes: 4 additions & 1 deletion templates/web/common/site_layout.tt.html
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,15 @@
[% INCLUDE 'web/common/includes/offdays_banner.tt.html' %]
[% ELSIF 1 == 2 %]
[% INCLUDE 'web/common/includes/packagings_banner.tt.html' %]
[% ELSE %]
[% ELSIF 2 == 3 %]
[%# we keep the old code so that we can easily put back the donation banner %]
[% PROCESS 'web/common/includes/off_days_2024_banner.tt.html' %]
[% banner_off_days_2024_top %]
[% PROCESS 'web/common/includes/donate_banner.tt.html' %]
[% banner_main %]
[% ELSE %]
[% PROCESS 'web/common/includes/donate_banner.tt.html' %]
[% banner_main %]
[% END %]
[% END %]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,43 +230,6 @@




<!-- start templates/web/common/includes/off_days_2024_banner.tt.html -->




<a href="//connect.openfoodfacts.org/event/open-food-facts-days-2024-22/register">
<section id="off-days-2024-banner-top" class="off-days-banner off-days-banner__ENG">
</section>
</a>

<script>
const offDaysBannerID = document.getElementById('off-days-2024-banner-top');

function getBannerCookie(bcname) {
const name = bcname + '=';
const decodedCookies = decodeURIComponent(document.cookie);
const cookies = decodedCookies.split(';');
for (const cookie of cookies) {
let c = cookie;
while (c.charAt(0) == ' ') { c = c.substring(1); }
if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); }
}

return '';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
console.log('cookie found');
offDaysBannerID.style.display = 'flex';
} else {
console.log('cookie not found');
offDaysBannerID.style.display = 'none';
}
</script>


<!-- start templates/web/common/includes/donate_banner.tt.html -->


Expand Down Expand Up @@ -326,11 +289,11 @@
}

function DonationButton() {
setBannerCookie('off_donation_banner_2023_a', 1, 180);
setBannerCookie('off_donation_banner_2024_a', 1, 180);
bannerID.style.display = 'none';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
if (getBannerCookie('off_donation_banner_2024_a') !== '') {
bannerID.style.display = 'none';
} else {
bannerID.style.display = 'flex';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,43 +230,6 @@




<!-- start templates/web/common/includes/off_days_2024_banner.tt.html -->




<a href="//connect.openfoodfacts.org/fr/event/open-food-facts-days-2024-22/register">
<section id="off-days-2024-banner-top" class="off-days-banner off-days-banner__FR">
</section>
</a>

<script>
const offDaysBannerID = document.getElementById('off-days-2024-banner-top');

function getBannerCookie(bcname) {
const name = bcname + '=';
const decodedCookies = decodeURIComponent(document.cookie);
const cookies = decodedCookies.split(';');
for (const cookie of cookies) {
let c = cookie;
while (c.charAt(0) == ' ') { c = c.substring(1); }
if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); }
}

return '';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
console.log('cookie found');
offDaysBannerID.style.display = 'flex';
} else {
console.log('cookie not found');
offDaysBannerID.style.display = 'none';
}
</script>


<!-- start templates/web/common/includes/donate_banner.tt.html -->


Expand Down Expand Up @@ -326,11 +289,11 @@
}

function DonationButton() {
setBannerCookie('off_donation_banner_2023_a', 1, 180);
setBannerCookie('off_donation_banner_2024_a', 1, 180);
bannerID.style.display = 'none';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
if (getBannerCookie('off_donation_banner_2024_a') !== '') {
bannerID.style.display = 'none';
} else {
bannerID.style.display = 'flex';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,43 +232,6 @@




<!-- start templates/web/common/includes/off_days_2024_banner.tt.html -->




<a href="//connect.openfoodfacts.org/event/open-food-facts-days-2024-22/register">
<section id="off-days-2024-banner-top" class="off-days-banner off-days-banner__ENG">
</section>
</a>

<script>
const offDaysBannerID = document.getElementById('off-days-2024-banner-top');

function getBannerCookie(bcname) {
const name = bcname + '=';
const decodedCookies = decodeURIComponent(document.cookie);
const cookies = decodedCookies.split(';');
for (const cookie of cookies) {
let c = cookie;
while (c.charAt(0) == ' ') { c = c.substring(1); }
if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); }
}

return '';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
console.log('cookie found');
offDaysBannerID.style.display = 'flex';
} else {
console.log('cookie not found');
offDaysBannerID.style.display = 'none';
}
</script>


<!-- start templates/web/common/includes/donate_banner.tt.html -->


Expand Down Expand Up @@ -328,11 +291,11 @@
}

function DonationButton() {
setBannerCookie('off_donation_banner_2023_a', 1, 180);
setBannerCookie('off_donation_banner_2024_a', 1, 180);
bannerID.style.display = 'none';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
if (getBannerCookie('off_donation_banner_2024_a') !== '') {
bannerID.style.display = 'none';
} else {
bannerID.style.display = 'flex';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,43 +243,6 @@




<!-- start templates/web/common/includes/off_days_2024_banner.tt.html -->




<a href="//connect.openfoodfacts.org/event/open-food-facts-days-2024-22/register">
<section id="off-days-2024-banner-top" class="off-days-banner off-days-banner__ENG">
</section>
</a>

<script>
const offDaysBannerID = document.getElementById('off-days-2024-banner-top');

function getBannerCookie(bcname) {
const name = bcname + '=';
const decodedCookies = decodeURIComponent(document.cookie);
const cookies = decodedCookies.split(';');
for (const cookie of cookies) {
let c = cookie;
while (c.charAt(0) == ' ') { c = c.substring(1); }
if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); }
}

return '';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
console.log('cookie found');
offDaysBannerID.style.display = 'flex';
} else {
console.log('cookie not found');
offDaysBannerID.style.display = 'none';
}
</script>


<!-- start templates/web/common/includes/donate_banner.tt.html -->


Expand Down Expand Up @@ -339,11 +302,11 @@
}

function DonationButton() {
setBannerCookie('off_donation_banner_2023_a', 1, 180);
setBannerCookie('off_donation_banner_2024_a', 1, 180);
bannerID.style.display = 'none';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
if (getBannerCookie('off_donation_banner_2024_a') !== '') {
bannerID.style.display = 'none';
} else {
bannerID.style.display = 'flex';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,43 +232,6 @@




<!-- start templates/web/common/includes/off_days_2024_banner.tt.html -->




<a href="//connect.openfoodfacts.org/event/open-food-facts-days-2024-22/register">
<section id="off-days-2024-banner-top" class="off-days-banner off-days-banner__ENG">
</section>
</a>

<script>
const offDaysBannerID = document.getElementById('off-days-2024-banner-top');

function getBannerCookie(bcname) {
const name = bcname + '=';
const decodedCookies = decodeURIComponent(document.cookie);
const cookies = decodedCookies.split(';');
for (const cookie of cookies) {
let c = cookie;
while (c.charAt(0) == ' ') { c = c.substring(1); }
if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); }
}

return '';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
console.log('cookie found');
offDaysBannerID.style.display = 'flex';
} else {
console.log('cookie not found');
offDaysBannerID.style.display = 'none';
}
</script>


<!-- start templates/web/common/includes/donate_banner.tt.html -->


Expand Down Expand Up @@ -328,11 +291,11 @@
}

function DonationButton() {
setBannerCookie('off_donation_banner_2023_a', 1, 180);
setBannerCookie('off_donation_banner_2024_a', 1, 180);
bannerID.style.display = 'none';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
if (getBannerCookie('off_donation_banner_2024_a') !== '') {
bannerID.style.display = 'none';
} else {
bannerID.style.display = 'flex';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,43 +232,6 @@




<!-- start templates/web/common/includes/off_days_2024_banner.tt.html -->




<a href="//connect.openfoodfacts.org/event/open-food-facts-days-2024-22/register">
<section id="off-days-2024-banner-top" class="off-days-banner off-days-banner__ENG">
</section>
</a>

<script>
const offDaysBannerID = document.getElementById('off-days-2024-banner-top');

function getBannerCookie(bcname) {
const name = bcname + '=';
const decodedCookies = decodeURIComponent(document.cookie);
const cookies = decodedCookies.split(';');
for (const cookie of cookies) {
let c = cookie;
while (c.charAt(0) == ' ') { c = c.substring(1); }
if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); }
}

return '';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
console.log('cookie found');
offDaysBannerID.style.display = 'flex';
} else {
console.log('cookie not found');
offDaysBannerID.style.display = 'none';
}
</script>


<!-- start templates/web/common/includes/donate_banner.tt.html -->


Expand Down Expand Up @@ -328,11 +291,11 @@
}

function DonationButton() {
setBannerCookie('off_donation_banner_2023_a', 1, 180);
setBannerCookie('off_donation_banner_2024_a', 1, 180);
bannerID.style.display = 'none';
}

if (getBannerCookie('off_donation_banner_2023_a') !== '') {
if (getBannerCookie('off_donation_banner_2024_a') !== '') {
bannerID.style.display = 'none';
} else {
bannerID.style.display = 'flex';
Expand Down
Loading
Loading