[openstreetmap/openstreetmap-website] Refactor embed.js.erb (PR #5550)

Anton Khorev notifications at github.com
Mon Jan 27 10:08:10 UTC 2025


@AntonKhorev 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);

Don't we have [layers.yml](https://github.com/openstreetmap/openstreetmap-website/blob/master/config/layers.yml) with all layers config? Only `mapnik` needs a special case, the rest can be generated from there. Maybe `"cycle map"` is also a special case, or we can remove spaces before looking up the layer.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5550#pullrequestreview-2575006648
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5550/review/2575006648 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250127/dc6d440c/attachment.htm>


More information about the rails-dev mailing list