From eaf6c17db47a6049be55d39a2b7f3190392742ac Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 13 Nov 2023 17:11:40 +0100 Subject: [PATCH] Picto field: only add category when at least one picto matches search --- umap/static/umap/js/umap.forms.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/umap.forms.js b/umap/static/umap/js/umap.forms.js index 87b8d0ab..35d7ad36 100644 --- a/umap/static/umap/js/umap.forms.js +++ b/umap/static/umap/js/umap.forms.js @@ -631,6 +631,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({ }, this ) + return true // Icon has been added (not filtered) }, clear: function () { @@ -645,13 +646,14 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({ const parent = L.DomUtil.create( 'div', 'umap-pictogram-category', - this.gridContainer ), title = L.DomUtil.add('h6', '', parent, category), grid = L.DomUtil.create('div', 'umap-pictogram-grid', parent) + let status = false for (let item of items) { - this.addIconPreview(item, grid) + status = this.addIconPreview(item, grid) || status } + if (status) this.gridContainer.appendChild(parent) }, buildSymbolsList: function () {