Support for viewing completed polls

This commit is contained in:
Jason McBrayer 2019-07-09 19:37:18 -04:00
parent 76b50cedd2
commit 83f46babe5
4 changed files with 190 additions and 146 deletions

View File

@ -240,6 +240,12 @@ a.navbar-item span:nth-child(2):before
content: " ";
}
div.poll {
margin-bottom: 1ex;
margin-top: 1em;
max-width: 90%;
}
/* Fix some rules that don't need to be there */
.content figure:not(:last-child)
{

View File

@ -2,7 +2,6 @@ body > section > div.container {
max-width: 100%;
}
.reblog-icon {
position: relative;
top: -24px;
@ -219,6 +218,14 @@ a.navbar-item span:nth-child(2):before
content: " ";
}
div.poll {
margin-bottom: 1ex;
margin-top: 1em;
max-width: 90%;
}
/* Fix some rules that don't need to be there */
.content figure:not(:last-child)
{

View File

@ -6,12 +6,12 @@
{% if active %}
<article id="toot-{{toot.id}}" class="media box active-context">
{% else %}
<article id="toot-{{toot.id}}" class="media box active-context">
{% else %}
<article id="toot-{{toot.id}}" class="media box">
{% endif %}
{% endif %}
<figure class="media-left">
<figure class="media-left">
<p class="image is-64x64 account-avatar">
<a href="{% url "user" toot.account.acct %}">
<img src="{{ toot.account.avatar_static }}"
@ -25,12 +25,13 @@
</a>
</p>
{% endif %}
</figure>
<div class="media-content">
</figure>
<div class="media-content">
<div class="content">
<p>
<strong>{{ toot.account.display_name }}</strong>
<small><a href="{% url "user" toot.account.acct %}">@{{ toot.account.acct }}</a></small>
<small><a href="{% url "user" toot.account.acct %}">
@{{ toot.account.acct }}</a></small>
<a href="{{ toot.url }}">
<small>{{ toot.created_at |humane_time }}</small>
</a>
@ -52,6 +53,17 @@
</div>
{% endif %}
{% if toot.poll %}
<div class="poll">
{% if toot.poll.voted or toot.poll.expired %}
{% include "polls/completed_partial.html" with toot=toot %}
{% else %}
<!-- Poll form -->
{% endif %}
</div>
{% endif %}
{% if toot.card %}
<div class="card">
<div class="card-content columns">
@ -211,6 +223,6 @@
</nav>
{% endif %}
</div>
<div class="media-right"></div>
</div>
<div class="media-right"></div>
</article>

View File

@ -0,0 +1,19 @@
{% load sanitizer %}
{% load taglinks %}
{% load static %}
<div class="columns is-multiline">
{% for option in toot.poll.options %}
<div class="column is-one-quarter">
<strong>{{ option.title }}</strong>
({{ option.votes_count}} vote{{ option.votes_count|pluralize }})
</div>
<div class="column is-three-quarters">
<progress class="progress is-primary"
value="{{ option.votes_count }}"
max="{{ toot.poll.votes_count }}"
{{ option.votes_count }}
</progress>
</div>
{% endfor %}
</div>