diff --git a/CHANGELOG.md b/CHANGELOG.md index 078a16fb2..16644e5cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- [Only require a name to build map popups #515](https://github.com/farmOS/farmOS/pull/515) + ### Security - Update Drupal core to 9.3.8 for [SA-CORE-2022-005](https://www.drupal.org/sa-core-2022-005). diff --git a/modules/core/map/js/farmOS.map.behaviors.popup.js b/modules/core/map/js/farmOS.map.behaviors.popup.js index fe28df070..96af29160 100644 --- a/modules/core/map/js/farmOS.map.behaviors.popup.js +++ b/modules/core/map/js/farmOS.map.behaviors.popup.js @@ -37,12 +37,16 @@ feature.set('name', names.length + ' item(s):'); } + // A popup name is required. var name = featureName(feature) || ''; - var description = feature.get('description') || ''; - var measurement = instance.measureGeometry(feature.getGeometry(), instance.units); + if (name !== '') { - // A popup name is required, along with a measurement and/or description. - if (name !== '' && (measurement !== '' || description !== '')) { + // Get the description and measurement. + var description = feature.get('description') || ''; + var measurement = instance.measureGeometry(feature.getGeometry(), instance.units); + + // Build content with all three values, even if empty. The measurement and description divs may be used + // as placeholders for map behaviors to place additional information. content = '

' + name + '

' + measurement + '
' + description + '
'; } }