From e24695b68c33c7099b18d32854b662601a6a9a5d Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 3 Apr 2025 14:51:04 +0200 Subject: [PATCH] wip: display tags in maps list --- umap/models.py | 4 ++++ umap/static/umap/content.css | 12 +++++++++++- umap/templates/umap/map_list.html | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/umap/models.py b/umap/models.py index fa083d42..58f5d4a7 100644 --- a/umap/models.py +++ b/umap/models.py @@ -417,6 +417,10 @@ class Map(NamedModel): datalayer.clone(map_inst=new) return new + def get_tags_display(self): + labels = dict(settings.UMAP_TAGS) + return [(t, labels.get(t, t)) for t in self.tags] + @classproperty def extra_schema(self): return { diff --git a/umap/static/umap/content.css b/umap/static/umap/content.css index b1573b0c..d55b58a7 100644 --- a/umap/static/umap/content.css +++ b/umap/static/umap/content.css @@ -171,7 +171,17 @@ h2.tabs a:hover { .more_button { min-height: var(--map-fragment-height); } - +.tag-list { + margin-top: var(--text-margin); + margin-bottom: var(--text-margin); +} +.tag-list li { + border: 1px solid var(--color-darkCyan); + border-radius: 3vmin; + display: inline-block; + padding: var(--button-padding-small); + white-space: nowrap; +} /* **************************** */ /* colors */ diff --git a/umap/templates/umap/map_list.html b/umap/templates/umap/map_list.html index 16e559f3..bdce48a8 100644 --- a/umap/templates/umap/map_list.html +++ b/umap/templates/umap/map_list.html @@ -4,6 +4,13 @@
{% map_fragment map_inst prefix=prefix page=request.GET.p %}
+ {% if map_inst.tags %} +
    + {% for tag, label in map_inst.get_tags_display %} +
  • {{ label }}
  • + {% endfor %} +
+ {% endif %}

{{ map_inst.name }}

{% with author=map_inst.get_author %} {% if author %}