From: Anton Khorev Date: Mon, 9 Dec 2024 22:23:41 +0000 (+0300) Subject: Rename 'keyid' layer option to 'layerId' X-Git-Tag: live~5^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/bfc8c5f6de1bc79f6d81a28e5c7e10ff300100b8?ds=inline;hp=-c Rename 'keyid' layer option to 'layerId' --- bfc8c5f6de1bc79f6d81a28e5c7e10ff300100b8 diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 9df0f0ad5..56495b31a 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -207,7 +207,7 @@ $(document).ready(function () { if (OSM.MATOMO) { map.on("layeradd", function (e) { if (e.layer.options) { - var goal = OSM.MATOMO.goals[e.layer.options.keyid]; + var goal = OSM.MATOMO.goals[e.layer.options.layerId]; if (goal) { $("body").trigger("matomogoal", goal); diff --git a/app/assets/javascripts/leaflet.map.js b/app/assets/javascripts/leaflet.map.js index f478f4351..02ed318ac 100644 --- a/app/assets/javascripts/leaflet.map.js +++ b/app/assets/javascripts/leaflet.map.js @@ -26,8 +26,6 @@ L.OSM.Map = L.Map.extend({ for (const [property, value] of Object.entries(layerDefinition)) { if (property === "credit") { layerOptions.attribution = makeAttribution(value); - } else if (property === "keyId") { - layerOptions.keyid = value; } else if (property === "nameId") { layerOptions.name = I18n.t(`javascripts.map.base.${value}`); } else if (property === "apiKeyId") { @@ -134,7 +132,7 @@ L.OSM.Map = L.Map.extend({ getMapBaseLayerId: function () { var baseLayerId; this.eachLayer(function (layer) { - if (layer.options && layer.options.keyid) baseLayerId = layer.options.keyid; + if (layer.options && layer.options.layerId) baseLayerId = layer.options.layerId; }); return baseLayerId; }, diff --git a/config/layers.yml b/config/layers.yml index 3b5bc944f..4f883cc94 100644 --- a/config/layers.yml +++ b/config/layers.yml @@ -1,6 +1,6 @@ - leafletOsmId: "Mapnik" code: "M" - keyId: "mapnik" + layerId: "mapnik" nameId: "standard" credit: id: "make_a_donation" @@ -9,7 +9,7 @@ - leafletOsmId: "CyclOSM" code: "Y" - keyId: "cyclosm" + layerId: "cyclosm" nameId: "cyclosm" credit: id: "cyclosm_credit" @@ -23,7 +23,7 @@ - leafletOsmId: "CycleMap" code: "C" - keyId: "cyclemap" + layerId: "cyclemap" nameId: "cycle_map" apiKeyId: "THUNDERFOREST_KEY" credit: @@ -35,7 +35,7 @@ - leafletOsmId: "TransportMap" code: "T" - keyId: "transportmap" + layerId: "transportmap" nameId: "transport_map" apiKeyId: "THUNDERFOREST_KEY" credit: @@ -47,7 +47,7 @@ - leafletOsmId: "TracestrackTopo" code: "P" - keyId: "tracestracktopo" + layerId: "tracestracktopo" nameId: "tracestracktop_topo" apiKeyId: "TRACESTRACK_KEY" credit: @@ -59,7 +59,7 @@ - leafletOsmId: "HOT" code: "H" - keyId: "hot" + layerId: "hot" nameId: "hot" credit: id: "hotosm_credit"