Put out linebreaks in popups

This commit is contained in:
Arne Schlüter 2015-02-08 12:00:37 +01:00
commit 07f80c0a3f

View file

@ -20,28 +20,6 @@ class Visualization {
this._markers = [] this._markers = []
} }
/**
* Clear the map and render new markers
* @param {Array[Object]} incidents The incidents to be shown
* @return {Visualization}
* @chainable
*/
displayMarkers (incidents) {
if (incidents == null)
incidents = this.data
this._markers.forEach(marker => { this.map.removeLayer(marker) })
this._markers = []
incidents.forEach(incident => {
this._markers.push(
this._createMarker(incident).bindPopup(incident.description)
)
})
return this
}
/** /**
* Gets all currently active categories * Gets all currently active categories
* @return {Array[string]} * @return {Array[string]}
@ -127,6 +105,24 @@ class Visualization {
return this return this
} }
/**
* Clear the map and render new markers
* @param {Array[Object]} incidents The incidents to be shown
* @return {Visualization}
* @chainable
*/
displayMarkers (incidents) {
if (incidents == null)
incidents = this.data
this._markers.forEach(marker => { this.map.removeLayer(marker) })
this._markers = incidents.map(incident => {
return this._createMarker(incident).bindPopup(incident.description.replace(/\n/g, '<br>'))
})
return this
}
/** /**
* Creates the correct marker for a single incident and adds it to the map * Creates the correct marker for a single incident and adds it to the map
* @param {Object} data A single incident * @param {Object} data A single incident