diff --git a/umap/settings/base.py b/umap/settings/base.py index ac1ff865..e741b5b8 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -292,16 +292,22 @@ UMAP_IMPORTERS = {} UMAP_HOST_INFOS = {} UMAP_LABEL_KEYS = ["name", "title"] UMAP_TAGS = ( - ("art", _("Art and Culture")), - ("bike", _("Bike")), + ("arts", _("Art and Culture")), + ("cycling", _("Cycling")), + ("business", _("Business")), ("environment", _("Environment")), ("education", _("Education")), ("food", _("Food and Agriculture")), + ("geopolitics", _("Geopolitics")), + ("health", _("Health")), + ("hiking", _("Hiking")), ("history", _("History")), ("public", _("Public sector")), + ("science", _("Science")), + ("shopping", _("Shopping")), ("sport", _("Sport and Leisure")), ("travel", _("Travel")), - ("trekking", _("Trekking")), + ("transports", _("Transports")), ("tourism", _("Tourism")), ) diff --git a/umap/static/umap/img/tags/arts.svg b/umap/static/umap/img/tags/arts.svg new file mode 100644 index 00000000..bfbb0a4e --- /dev/null +++ b/umap/static/umap/img/tags/arts.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/business.svg b/umap/static/umap/img/tags/business.svg new file mode 100644 index 00000000..3d013b87 --- /dev/null +++ b/umap/static/umap/img/tags/business.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/cycling.svg b/umap/static/umap/img/tags/cycling.svg new file mode 100644 index 00000000..b2758b26 --- /dev/null +++ b/umap/static/umap/img/tags/cycling.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/education.svg b/umap/static/umap/img/tags/education.svg new file mode 100644 index 00000000..a1275493 --- /dev/null +++ b/umap/static/umap/img/tags/education.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/environment.svg b/umap/static/umap/img/tags/environment.svg new file mode 100644 index 00000000..b2cc25b0 --- /dev/null +++ b/umap/static/umap/img/tags/environment.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/food.svg b/umap/static/umap/img/tags/food.svg new file mode 100644 index 00000000..c99d0a0d --- /dev/null +++ b/umap/static/umap/img/tags/food.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/geopolitics.svg b/umap/static/umap/img/tags/geopolitics.svg new file mode 100644 index 00000000..c78ca4d3 --- /dev/null +++ b/umap/static/umap/img/tags/geopolitics.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/health.svg b/umap/static/umap/img/tags/health.svg new file mode 100644 index 00000000..1a85bc33 --- /dev/null +++ b/umap/static/umap/img/tags/health.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/hiking.svg b/umap/static/umap/img/tags/hiking.svg new file mode 100644 index 00000000..a9998188 --- /dev/null +++ b/umap/static/umap/img/tags/hiking.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/history.svg b/umap/static/umap/img/tags/history.svg new file mode 100644 index 00000000..e11ac259 --- /dev/null +++ b/umap/static/umap/img/tags/history.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/public.svg b/umap/static/umap/img/tags/public.svg new file mode 100644 index 00000000..0b0a22a3 --- /dev/null +++ b/umap/static/umap/img/tags/public.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/science.svg b/umap/static/umap/img/tags/science.svg new file mode 100644 index 00000000..62455547 --- /dev/null +++ b/umap/static/umap/img/tags/science.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/shopping.svg b/umap/static/umap/img/tags/shopping.svg new file mode 100644 index 00000000..743c09b9 --- /dev/null +++ b/umap/static/umap/img/tags/shopping.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/sport.svg b/umap/static/umap/img/tags/sport.svg new file mode 100644 index 00000000..a439d17d --- /dev/null +++ b/umap/static/umap/img/tags/sport.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/tourism.svg b/umap/static/umap/img/tags/tourism.svg new file mode 100644 index 00000000..6c9253a9 --- /dev/null +++ b/umap/static/umap/img/tags/tourism.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/transports.svg b/umap/static/umap/img/tags/transports.svg new file mode 100644 index 00000000..acaaf9d7 --- /dev/null +++ b/umap/static/umap/img/tags/transports.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/img/tags/travel.svg b/umap/static/umap/img/tags/travel.svg new file mode 100644 index 00000000..3a506124 --- /dev/null +++ b/umap/static/umap/img/tags/travel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/umap/static/umap/js/modules/form/builder.js b/umap/static/umap/js/modules/form/builder.js index f3d62327..618b84d9 100644 --- a/umap/static/umap/js/modules/form/builder.js +++ b/umap/static/umap/js/modules/form/builder.js @@ -141,6 +141,7 @@ export class MutatingForm extends Form { facetKey: 'PropertyInput', slugKey: 'PropertyInput', labelKey: 'PropertyInput', + tags: 'TagsEditor', } for (const [key, defaults] of Object.entries(SCHEMA)) { const properties = Object.assign({}, defaults) diff --git a/umap/static/umap/js/modules/form/fields.js b/umap/static/umap/js/modules/form/fields.js index 514b7c27..29f44aeb 100644 --- a/umap/static/umap/js/modules/form/fields.js +++ b/umap/static/umap/js/modules/form/fields.js @@ -325,11 +325,16 @@ Fields.CheckBox = class extends BaseElement { } Fields.CheckBoxes = class extends BaseElement { + getInputTemplate(value, label) { + return `` + } + build() { const initial = this.get() || [] for (const [value, label] of this.properties.choices) { - const tpl = `` - const [root, { input }] = Utils.loadTemplateWithRefs(tpl) + const [root, { input }] = Utils.loadTemplateWithRefs( + this.getInputTemplate(value, label) + ) this.container.appendChild(root) input.checked = initial.includes(value) input.addEventListener('change', () => this.sync()) @@ -342,6 +347,18 @@ Fields.CheckBoxes = class extends BaseElement { } } +Fields.TagsEditor = class extends Fields.CheckBoxes { + getInputTemplate(value, label) { + const path = SCHEMA.iconUrl.default.replace('marker.svg', `tags/${value}.svg`) + return ` + + ` + } +} + Fields.Select = class extends BaseElement { getTemplate() { return `` diff --git a/umap/static/umap/map.css b/umap/static/umap/map.css index 998d8d12..e9b32794 100644 --- a/umap/static/umap/map.css +++ b/umap/static/umap/map.css @@ -935,6 +935,20 @@ a.umap-control-caption, display: block; } +/* **** */ +/* Tags */ +/* **** */ + +.tag-icon { + width: 20px; + height: 20px; + margin-bottom: -4px; + margin-right: 3px; +} +.dark .tag-icon { + filter: invert(1); +} + /* *************************** */ /* Overriding leaflet defaults */ /* *************************** */