-
-
Notifications
You must be signed in to change notification settings - Fork 400
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: donation banner tweaks #7703
fix: donation banner tweaks #7703
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sultanowski really cool !
I tested it, it works for me.
I think there is code in Display.pm (line 7621) that should be cleaned up.
I wait for some suggestion resolutions to approve.
d.setTime(d.getTime() + (bcexdays*60*60*24*1000)); | ||
let expires = 'expires=' + d.toUTCString(); | ||
document.cookie = bcname + '=' + bcval + ';' + expires + ';path=/'; | ||
console.log(expires); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should remove this :-)
console.log(expires); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, forgot about those! Thank you, I will remove it soon, also unused vars and logs.
function deleteBannerCookie(bcname) { | ||
d.setTime(d.getTime() + (60*60*24*1000)); | ||
let expires = 'expires=' + d.toUTCString(); | ||
document.cookie = bcname + '=;' + expires + ';path=/'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this, and not only call setBannerCookie ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's like a double-check for me - cleans the cookie value and set expire for current time, if you feel like it is not really important I can test the code without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, it's ok if we keep it, but maybe a comment to explain is good :-)
|
||
<script> | ||
let d = new Date(); | ||
let expires = 'expires=' + d.toUTCString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems we don't need this any-more ?
let d = new Date(); | ||
let expires = 'expires=' + d.toUTCString(); | ||
let bannerID = document.getElementById('donate-banner'); | ||
let bcval = "1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems we don't need this any-more ?
|
||
function DonationButton() { | ||
deleteBannerCookie('off-donation-banner'); | ||
setBannerCookie('off-donation-banner', 1, 14); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seems to me 14 days is not enough, it's a bit pushy to users.
If I donate, I would expect this not to show up again for at least 180 days !
If possible, I would set it on whole openfoodfacts.xx subdomain (not only for eg. world) (that is you can set domain to the last two components of domain).
@teolemon what is your though ?
And on wide screen, we lose the max width that we had before, which makes the text hard to read on a very long line. It's certainly a personal test, but I prefer the behaviour we had before for mobile and desktop. Would it be possible to have a behaviour more like we had before, but with the new "Close" mark you added? |
Note that yesterday we added a 2nd donation box (identical except that it cannot be closed) at the bottom of the page, so unfortunately it's causing some conflicts. |
Pushed cosmetic changes mentioned in this discussion, banner is slightly smaller than the actual one. What should I do to resolve this conflict? I didn't pulled to this branch during development and I don't want to merge it with |
@sultanowski the best would be to sync main branch on your project, update main locally, switch to your branch, then use "rebase main" (read some tutorial, it's a good command to master). Then you have to "git push --force". |
@alexgarel I found solution to apply a cookie for all subdomains and all possible versions (.org, .net, etc.) now I am going to rebase and update this branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you !
@sultanowski still a small problem and we are done :-)
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
What I've done in small summary:
|
Fine @sultanowski, thank you so much for your dedication ! I think we could improve styling because the banner is a bit deported on the right because of the "hand-heart" icon on the right… but that would be for another PR :-) |
What
document.cookie
code and placed it directly indonate_banner.tt.html
file.Screenshot
https://imgur.com/a/3KPz3Ov
Related issue(s) and discussion