From ae4def114789898de2b3dc9b5f25e59942acf8ec Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Wed, 26 Jul 2023 18:33:30 +0200 Subject: show names of tagged people on hover --- fietsboek/models/track.py | 10 ++++++++++ fietsboek/templates/home.jinja2 | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) 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'{"".join(rows)}
') + 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("
  • {}
  • ").format(person.name) for person in people) + return Markup("").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) }} - {% if track.tagged_people %}{{ track.tagged_people | length + 1 }}  {% endif %} + {% if track.tagged_people %} + + {{ track.tagged_people | length + 1 }}   + + {% endif %} {{ (track.length / 1000) | round(2) | format_decimal }} km -- cgit v1.2.3