diff --git a/umap/static/umap/js/umap.forms.js b/umap/static/umap/js/umap.forms.js index b3970973..1aabfec5 100644 --- a/umap/static/umap/js/umap.forms.js +++ b/umap/static/umap/js/umap.forms.js @@ -372,6 +372,7 @@ L.FormBuilder.PopupContent = L.FormBuilder.Select.extend({ ['Table', L._('Table')], ['GeoRSSImage', L._('GeoRSS (title + image)')], ['GeoRSSLink', L._('GeoRSS (only link)')], + ['OSM', L._('OpenStreetMap')], ], }) diff --git a/umap/static/umap/js/umap.popup.js b/umap/static/umap/js/umap.popup.js index 6bccceed..e6b1d50f 100644 --- a/umap/static/umap/js/umap.popup.js +++ b/umap/static/umap/js/umap.popup.js @@ -251,3 +251,24 @@ L.U.PopupTemplate.GeoRSSLink = L.U.PopupTemplate.Default.extend({ return a }, }) + +L.U.PopupTemplate.OSM = L.U.PopupTemplate.Default.extend({ + options: { + className: 'umap-openstreetmap', + }, + + getName: function () { + const props = this.feature.properties + if (L.locale && props[`name:${L.locale}`]) return props[`name:${L.locale}`]; + return props.name + }, + + renderBody: function () { + const props = this.feature.properties + let kind = props.shop || props.amenity || props.craft + const container = L.DomUtil.add('div') + const kindEl = L.DomUtil.add('h4', '', container, kind) + L.DomUtil.add('h3', 'popup-title', container, this.getName()) + return container + }, +})