X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/898cc828dd1f1167f85abbf35c8e3f0ed640ac1e..0a4b8604804f5e586718c6224700dde31afae090:/app/assets/javascripts/index/notes.js.erb diff --git a/app/assets/javascripts/index/notes.js.erb b/app/assets/javascripts/index/notes.js.erb index e67749f07..9fb03bb0d 100644 --- a/app/assets/javascripts/index/notes.js.erb +++ b/app/assets/javascripts/index/notes.js.erb @@ -41,6 +41,10 @@ $(document).ready(function () { } }); + map.on("popupopen", function (e) { + $(e.popup._container).find(".comment").focus(); + }); + map.on("popupclose", function (e) { if (newNote && e.popup == newNote._popup) { $(newNote).oneTime(10, "removenote", function () { @@ -71,22 +75,22 @@ $(document).ready(function () { } function updateMarker(marker, feature) { - var icon = noteIcons[feature.properties.status]; - var popupContent = createPopupContent(marker, feature.properties); - if (marker) { marker.setIcon(noteIcons[feature.properties.status]); - marker._popup.setContent(popupContent); + marker._popup.setContent(createPopupContent(marker, feature.properties)); } else { marker = L.marker(feature.geometry.coordinates.reverse(), { - icon: icon, + icon: noteIcons[feature.properties.status], opacity: 0.7 }); - marker.addTo(noteLayer).bindPopup(popupContent, popupOptions()); + marker.addTo(noteLayer).bindPopup( + createPopupContent(marker, feature.properties), + popupOptions() + ); } return marker;