[openstreetmap/openstreetmap-website] Add yearly template and CalendarLabel plugin for month labels (PR #5906)
Emin Kocan
notifications at github.com
Sun Apr 13 16:25:54 UTC 2025
kcne left a comment (openstreetmap/openstreetmap-website#5906)
Got this working using the `CalendarLabel` plugin, though I'm seeing some CSP warnings in the console. I'm pretty sure the CSP warnings here are related to [CalendarLabel](https://cal-heatmap.com/docs/plugins/calendarLabel) plugin.
- The first week is fully rendered.
- The heatmap always ends on today's date.
- Starting day of the week is localized.
- Refactored so the code stays inside `DOMContentLoaded` event listener.
#### Screenshots
Sunday as first day locale:
<img width="952" alt="Screenshot 2025-04-13 at 18 13 20" src="https://github.com/user-attachments/assets/74f3b83d-7ba2-4ea3-83fc-1a39af9b0809" />
Monday as first day locale:
<img width="956" alt="Screenshot 2025-04-13 at 18 13 39" src="https://github.com/user-attachments/assets/c2f848fc-fdb4-4265-9256-ef984c2f36df" />
CSP warnings:
<img width="1512" alt="Screenshot 2025-04-13 at 18 14 03" src="https://github.com/user-attachments/assets/2e0b50fb-4a22-4faf-9e01-67be89b8ebd6" />
### Notes
- One challenge I ran into was rendering day labels in the view. I couldn’t find a way to determine whether the week starts on Sunday or Monday from within the view itself, so I opted to use `CalendarLabel` here as well.
- For rendering the month labels, I opted for the `CalendarLabel` API—it’s much cleaner this way, as computing and positioning the labels manually would be unnecessarily complex.
I'm unsure whether we should adjust the config to resolve the CSP warnings, or consider refactoring to manually render the labels instead. Would appreciate any thoughts or suggestions here..
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5906#issuecomment-2800018290
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5906/c2800018290 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250413/bdb4d732/attachment.htm>
More information about the rails-dev
mailing list