diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2024-02-29 22:04:55 +0200 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2024-12-21 19:43:13 +0200 |
| commit | 3620ac2671651eb096e49845e2ef500918e90d2a (patch) | |
| tree | 20d36d20b39fe02f501513a2241b5636f672d8ac | |
| parent | 5c64529e77f150f8b83930f17e792b2cb8e38a87 (diff) | |
Fix list view voters, change font
| -rw-r--r-- | db.py | 8 | ||||
| -rw-r--r-- | static/styles.css | 18 | ||||
| -rw-r--r-- | templates/manage.html.j2 | 1 | ||||
| -rw-r--r-- | templates/poll_vote_list.html.j2 | 6 |
4 files changed, 29 insertions, 4 deletions
@@ -83,6 +83,9 @@ class Choice: return self.start_datetime.date() == self.end_datetime.date() \ and self.start_datetime.time() == self.end_datetime.time() + def votes_with_value(self, value: int) -> list[Vote]: + return [vote for vote in self.votes if vote.value == value] + @dataclass class Poll: id: str @@ -95,6 +98,11 @@ class Poll: manage_code: str is_whole_day: bool + def pub_date_formatted_notz(self): + date = self.pub_date.replace(tzinfo = None).strftime("%d.%m.%Y") + time = self.pub_date.replace(tzinfo = None).strftime("%H:%M") + return f"Created on {date} at {time}" + def share_url(self): return f"{BASE_URL}/poll/{self.id}" diff --git a/static/styles.css b/static/styles.css index 0e538e8..0ddd9f4 100644 --- a/static/styles.css +++ b/static/styles.css @@ -1,5 +1,5 @@ html { - font-family: "Helvetica Neue", "Arial", sans-serif; + font-family: "Verdana", "Arial", sans-serif !important; font-size: 16px; } @@ -9,8 +9,22 @@ body { margin: 0 auto; } +h1 { + margin-bottom: 40px; +} + +h1 a { + color: black; + text-decoration: none; +} + +h1:hover a { + border-bottom: 2px dotted #fa8e35; + text-decoration: none; +} + textarea { - font-family: "Helvetica Neue", "Arial", sans-serif; + font-family: "Verdana", "Arial", sans-serif; font-size: 16px; } diff --git a/templates/manage.html.j2 b/templates/manage.html.j2 index 4a5da8d..db7da0b 100644 --- a/templates/manage.html.j2 +++ b/templates/manage.html.j2 @@ -3,6 +3,7 @@ {% block content %} <h2>Managing poll <span class="contrast">{{ poll.title }}</span> by <i>{{ poll.author_name }}</i></h2> +<p>{{ poll.pub_date_formatted_notz() }}.</p> <p> Share this URL with your peers:<br> diff --git a/templates/poll_vote_list.html.j2 b/templates/poll_vote_list.html.j2 index 845356b..a9b2a48 100644 --- a/templates/poll_vote_list.html.j2 +++ b/templates/poll_vote_list.html.j2 @@ -10,8 +10,10 @@ <i>{{ choice.votes | length }} votes</i> </span> <div> - {% if choice.votes | length != 0 %} - Voted by: {% for vote in choice.votes %}{{ vote.voter_name }}{% if not loop.last %}, {% endif %}{% endfor %} + {% if choice.votes_with_value(1) | length != 0 %} + Voted by: {% for vote in choice.votes_with_value(1) %} + {{ vote.voter_name }}{% if not loop.last %}, {% endif %} + {% endfor %} {% endif %} </div> </label> |
