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 { .most_voted {
opacity: 0.45; opacity: 0.45;
width: 100%;
} }
/* Used only for text post preview */ /* Used only for text post preview */

View File

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