fix(polls): minor improvements

This commit is contained in:
Ondřej Pešek 2023-04-01 14:31:39 +02:00
parent 75af984154
commit 94a781c82c
2 changed files with 5 additions and 4 deletions

View file

@ -988,6 +988,7 @@ a.search_subreddit:hover {
.most_voted {
opacity: 0.45;
width: 100%;
}
/* Used only for text post preview */

View file

@ -311,8 +311,8 @@
{% when Some with (poll) %}
{% let widest = poll.most_votes() %}
<div class="post_poll">
<span>{{ poll.total_vote_count }} votes</span>
<span>{{ poll.voting_end_timestamp.0 }}</span>
<span>{{ poll.total_vote_count }} votes,</span>
<span title="{{ poll.voting_end_timestamp.1 }}">{{ poll.voting_end_timestamp.0 }}</span>
{% for option in poll.poll_options %}
<div class="poll_option">
{# Posts without vote_count (all open polls) will show up without votes.
@ -320,13 +320,13 @@
{% match option.vote_count %}
{% when Some with (vote_count) %}
{% if vote_count.eq(widest) || widest == 0 %}
<div class="poll_chart most_voted" style="width: 100%"></div>
<div class="poll_chart most_voted"></div>
{% else %}
<div class="poll_chart" style="width: {{ (vote_count * 100) / widest }}%"></div>
{% endif %}
<span>{{ vote_count }}</span>
{% when None %}
<div class="poll_chart most_voted" style="width: 100%"></div>
<div class="poll_chart most_voted"></div>
<span></span>
{% endmatch %}
<span>{{ option.text }}</span>