[openstreetmap/openstreetmap-website] Refactor embed.js.erb with layers.yml (PR #5571)
Tom Hughes
notifications at github.com
Wed Jan 29 18:57:20 UTC 2025
@tomhughes commented on this pull request.
> <% end %>
};
var map = L.map("map");
map.attributionControl.setPrefix("");
map.removeControl(map.attributionControl);
- if (args.layer === "cyclosm") {
- new L.OSM.CyclOSM().addTo(map);
- } else if (args.layer === "cyclemap" || args.layer === "cycle map") {
- new L.OSM.CycleMap(thunderforestOptions).addTo(map);
- } else if (args.layer === "transportmap") {
- new L.OSM.TransportMap(thunderforestOptions).addTo(map);
- } else if (args.layer === "hot") {
- new L.OSM.HOT().addTo(map);
- } else {
- new L.OSM.Mapnik(mapnikOptions).addTo(map);
- }
+ const layers = <%=
+(YAML.load_file(Rails.root.join("config/layers.yml"))
I don't believe the outer parentheses are needed here? I tried it in the rails console and I got the same JSON without them...
Also can we indent the ruby code by four spaces so it's a bit more readable? or does that trigger some lint issue?
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5571#pullrequestreview-2581945317
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5571/review/2581945317 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250129/87efe469/attachment.htm>
More information about the rails-dev
mailing list