[openstreetmap/openstreetmap-website] Refactor embed.js.erb (PR #5550)
Marwin Hochfelsner
notifications at github.com
Mon Jan 27 10:26:04 UTC 2025
@hlfan commented on this pull request.
> + var baseLayers = {
+ cyclosm: ["CyclOSM"],
+ cyclemap: ["CycleMap", thunderforestOptions],
+ transportmap: ["TransportMap", thunderforestOptions],
+ hot: ["HOT"],
+ mapnik: ["Mapnik", mapnikOptions]
+ };
+ baseLayers["cycle map"] = baseLayers.cyclemap;
+ var [layer, options] = baseLayers[args.layer] || baseLayers.mapnik;
+ new L.OSM[layer](options || {}).addTo(map);
I also think big potential here was hidden in the else-if chain. I definitely can see the next version here be [layers.yml](//github.com/openstreetmap/openstreetmap-website/blob/master/config/layers.yml)-based, but it should be filtered to what's necessary and include toggling to `leafletOsmDarkId`.
And I haven't figured out how to do that compactly so this is more of a stop-gap that I can throw a ternary onto to add dark mode later.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5550#discussion_r1930295112
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5550/review/2575047252 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250127/5d81c81d/attachment.htm>
More information about the rails-dev
mailing list