-
-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Display off days banner if donation banner was hidden (#10566)
### What We have to integrate off days 2024 banner, but we want to display it only if donnation banner was closed --------- Co-authored-by: Stéphane Gigandet <[email protected]> Co-authored-by: Open Food Facts Bot <[email protected]>
- Loading branch information
1 parent
2389be1
commit 5107f3e
Showing
60 changed files
with
2,103 additions
and
159 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
templates/web/common/includes/off_days_2024_banner.tt.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!-- start templates/[% component.name %] --> | ||
|
||
[% banner_off_days_2024_top = BLOCK %] | ||
|
||
<a href="[% lang('link_off_days_banner') %]"> | ||
<section id="off-days-2024-banner-top" class="off-days-banner off-days-banner__[% lang('src_off_days_banner') %]"> | ||
</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> | ||
|
||
[% END %] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.