diff options
| -rw-r--r-- | fietsboek/models/track.py | 10 | ||||
| -rw-r--r-- | fietsboek/templates/home.jinja2 | 6 | 
2 files changed, 15 insertions, 1 deletions
diff --git a/fietsboek/models/track.py b/fietsboek/models/track.py index 53961c3..8025f6a 100644 --- a/fietsboek/models/track.py +++ b/fietsboek/models/track.py @@ -607,6 +607,16 @@ class TrackWithMetadata:          ]          return Markup(f'<table>{"".join(rows)}</table>') +    def html_tooltip_tagged_people(self) -> Markup: +        """Returns the tagged people as HTML, ready to be shown as a tooltip. + +        :return: The generated HTML. +        """ +        people = [self.owner] + list(self.tagged_people) +        people.sort(key=lambda p: p.name) +        html_list = "".join(Markup("<li>{}</li>").format(person.name) for person in people) +        return Markup("<ul class="mb-0">{}</ul>").format(html_list) +      # Proxied properties      @property      def id(self) -> Optional[int]: diff --git a/fietsboek/templates/home.jinja2 b/fietsboek/templates/home.jinja2 index 9835cfb..383e90a 100644 --- a/fietsboek/templates/home.jinja2 +++ b/fietsboek/templates/home.jinja2 @@ -45,7 +45,11 @@              {{ track.title | default(track.date, true) }}            </a>            <span class="float-end"> -              {% if track.tagged_people %}{{ track.tagged_people | length + 1 }} <i class="bi bi-people-fill"></i>  {% endif %} +              {% if track.tagged_people %} +              <span data-bs-toggle="tooltip" data-bs-container="body" data-bs-html="true" title="{{ track.html_tooltip_tagged_people() }}"> +                  {{ track.tagged_people | length + 1 }} <i class="bi bi-people-fill"></i>   +              </span> +              {% endif %}                {{ (track.length / 1000) | round(2) | format_decimal }} km            </span>          </span>  | 
