Skip to content

Commit

Permalink
Rename 'keyid' layer option to 'layerId'
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Dec 9, 2024
1 parent 7b05c1c commit bfc8c5f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions app/assets/javascripts/leaflet.map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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;
},
Expand Down
12 changes: 6 additions & 6 deletions config/layers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- leafletOsmId: "Mapnik"
code: "M"
keyId: "mapnik"
layerId: "mapnik"
nameId: "standard"
credit:
id: "make_a_donation"
Expand All @@ -9,7 +9,7 @@

- leafletOsmId: "CyclOSM"
code: "Y"
keyId: "cyclosm"
layerId: "cyclosm"
nameId: "cyclosm"
credit:
id: "cyclosm_credit"
Expand All @@ -23,7 +23,7 @@

- leafletOsmId: "CycleMap"
code: "C"
keyId: "cyclemap"
layerId: "cyclemap"
nameId: "cycle_map"
apiKeyId: "THUNDERFOREST_KEY"
credit:
Expand All @@ -35,7 +35,7 @@

- leafletOsmId: "TransportMap"
code: "T"
keyId: "transportmap"
layerId: "transportmap"
nameId: "transport_map"
apiKeyId: "THUNDERFOREST_KEY"
credit:
Expand All @@ -47,7 +47,7 @@

- leafletOsmId: "TracestrackTopo"
code: "P"
keyId: "tracestracktopo"
layerId: "tracestracktopo"
nameId: "tracestracktop_topo"
apiKeyId: "TRACESTRACK_KEY"
credit:
Expand All @@ -59,7 +59,7 @@

- leafletOsmId: "HOT"
code: "H"
keyId: "hot"
layerId: "hot"
nameId: "hot"
credit:
id: "hotosm_credit"
Expand Down

0 comments on commit bfc8c5f

Please sign in to comment.