From ceab5090a71d3c0490a25a781fc438c05f8631c2 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Fri, 14 Jun 2024 17:20:16 -0400 Subject: [PATCH 1/3] fix: explicit import paths for collectstatic hashes --- umap/static/umap/js/modules/importer.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/umap/static/umap/js/modules/importer.js b/umap/static/umap/js/modules/importer.js index ef450da6..df7a3222 100644 --- a/umap/static/umap/js/modules/importer.js +++ b/umap/static/umap/js/modules/importer.js @@ -55,10 +55,25 @@ export default class Importer { } loadImporters() { - for (const key of Object.keys(this.map.options.importers || {})) { - import(`./importers/${key}.js`).then((mod) => { - this.IMPORTERS.push(new mod.Importer(this.map, this.map.options.importers[key])) - }) + for (const [name, config] of Object.entries(this.map.options.importers || {})) { + const register = (mod) => { + this.IMPORTERS.push(new mod.Importer(this.map, config)) + } + // We need to have explicit static paths for Django's collectstatic with hashes. + switch (name) { + case 'geodatamine': + import('./importers/geodatamine.js').then(register) + break + case 'communesfr': + import('./importers/communesfr.js').then(register) + break + case 'overpass': + import('./importers/overpass.js').then(register) + break + case 'datasets': + import('./importers/datasets.js').then(register) + break + } } } From a3afadb677d9a98bd3c1b30ef30656dbb2c4abe0 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Fri, 14 Jun 2024 17:21:09 -0400 Subject: [PATCH 2/3] fix: hide importers section if none is defined --- umap/static/umap/js/modules/importer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/umap/static/umap/js/modules/importer.js b/umap/static/umap/js/modules/importer.js index df7a3222..37e0dedb 100644 --- a/umap/static/umap/js/modules/importer.js +++ b/umap/static/umap/js/modules/importer.js @@ -12,14 +12,16 @@ const TEMPLATE = ` -
+
- ${translate('Choose the format')} + ${translate( + 'Choose the format' + )}
@@ -147,7 +149,7 @@ export default class Importer { for (const plugin of this.IMPORTERS.sort((a, b) => (a.id > b.id ? 1 : -1))) { L.DomUtil.createButton( plugin.id, - DomUtil.element({tagName: 'li', parent}), + DomUtil.element({ tagName: 'li', parent }), plugin.name, () => plugin.open(this) ) From 411452ac70c1a6528ec81f9b22e3cd1e1662ae69 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Fri, 14 Jun 2024 17:36:20 -0400 Subject: [PATCH 3/3] fix: allow first radio input click when second selected --- umap/static/umap/base.css | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/umap/static/umap/base.css b/umap/static/umap/base.css index 3fd1bac7..bad66b3a 100644 --- a/umap/static/umap/base.css +++ b/umap/static/umap/base.css @@ -203,27 +203,24 @@ input[type=checkbox]:checked:after { label input[type="radio"] { appearance: none; margin-right: 10px; + background: var(--color-darkGray); } input[type="radio"]:after { display: inline-block; - content: ' '; - width: 12px; - height: 12px; + content: '⦾'; + width: 16px; + height: 16px; border-radius: 50%; - border: 1px solid var(--color-lightGray); cursor: pointer; text-align: center; - font-size: 1.3rem; - line-height: 1rem; vertical-align: bottom; + font-size: 1.2rem; + line-height: 0.7; } label input[type="radio"]:checked:after { background-color: var(--color-lightCyan); - content: '•'; - font-size: 3rem; - line-height: 0.8rem; color: var(--color-darkGray); - text-indent: -1px; + content: '⦿'; } input[data-modified=true] {