wip: display tags in maps list

This commit is contained in:
Yohan Boniface 2025-04-03 14:51:04 +02:00
parent db72bfad8d
commit e24695b68c
3 changed files with 22 additions and 1 deletions

View file

@ -417,6 +417,10 @@ class Map(NamedModel):
datalayer.clone(map_inst=new) datalayer.clone(map_inst=new)
return 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 @classproperty
def extra_schema(self): def extra_schema(self):
return { return {

View file

@ -171,7 +171,17 @@ h2.tabs a:hover {
.more_button { .more_button {
min-height: var(--map-fragment-height); 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 */ /* colors */

View file

@ -4,6 +4,13 @@
<div> <div>
{% map_fragment map_inst prefix=prefix page=request.GET.p %} {% map_fragment map_inst prefix=prefix page=request.GET.p %}
<hgroup> <hgroup>
{% if map_inst.tags %}
<ul class="tag-list">
{% for tag, label in map_inst.get_tags_display %}
<li><a href="{% url 'search' %}?tags={{ tag }}">{{ label }}</a></li>
{% endfor %}
</ul>
{% endif %}
<h3><a href="{{ map_inst.get_absolute_url }}">{{ map_inst.name }}</a></h3> <h3><a href="{{ map_inst.get_absolute_url }}">{{ map_inst.name }}</a></h3>
{% with author=map_inst.get_author %} {% with author=map_inst.get_author %}
{% if author %} {% if author %}