aurweb/templates/partials/tu/proposal/details.html
Kevin Morris 9e3c2e15ea
feat: allow TUs to change their votes on running proposals
In addition, this patch brings in display for the vote decision
you cast on it. This is only viewable by the request user; your
vote is not being shared with others.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-03-07 23:13:08 -08:00

118 lines
3.5 KiB
HTML

<h2>{% trans %}Proposal Details{% endtrans %}</h2>
{% if voteinfo.is_running() %}
<p class="vote-running" style="font-weight: bold; color: red">
{% trans %}This vote is still running.{% endtrans %}<br />
{% if vote %}
{{ "You've already voted for this proposal." | tr }}
{{ "You can change your vote while the proposal is still running." | tr }}
{% endif %}
</p>
{% endif %}
<!-- The margin style here mimics the margin on the old <p> element. -->
<div class="proposal details">
<div class="field user">
{{ "User" | tr }}:
<strong>
{% if voteinfo.User %}
<a href="{{ '/packages/?K=%s&SeB=m' | format(voteinfo.User)}}">
{{ voteinfo.User }}
</a>
{% else %}
N/A
{% endif %}
</strong>
</div>
{% set submitter = voteinfo.Submitter.Username %}
{% set submitter_uri = "/account/%s" | format(submitter) %}
{% set submitter = '<a href="%s">%s</a>' | format(submitter_uri, submitter) %}
<div class="field submitted">
{{
"Submitted: %s by %s" | tr
| format(datetime_display(voteinfo.Submitted), submitter)
| safe
}}
</div>
<div class="field end">
{{ "End" | tr }}:
<strong>
{{ datetime_display(voteinfo.End) }}
</strong>
</div>
{% if vote and vote.Decision %}
<div class="field">
{{ "Your vote" | tr }}:
<strong>{{ vote.display() }}</strong>
</div>
{% endif %}
{% if not voteinfo.is_running() %}
<div class="field result">
{{ "Result" | tr }}:
{% if not voteinfo.ActiveTUs %}
<span>{{ "unknown" | tr }}</span>
{% elif accepted %}
<span style="color: green; font-weight: bold">
{{ "Accepted" | tr }}
</span>
{% else %}
<span style="color: red; font-weight: bold">
{{ "Rejected" | tr }}
</span>
{% endif %}
</div>
{% endif %}
</div>
<div class="proposal agenda">
<p class="field agenda">
<!-- The `e` filter manually escapes content. -->
{{ voteinfo.Agenda | replace("\n", "<br />\n") | safe | e }}
</p>
</div>
<table class="vote-status">
<tr>
{% if not voteinfo.is_running() %}
<th>{{ "Yes" | tr }}</th>
<th>{{ "No" | tr }}</th>
<th>{{ "Abstain" | tr }}</th>
{% endif %}
<th>{{ "Total" | tr }}</th>
<th>{{ "Voted" | tr }}</th>
<th>{{ "Participation" | tr }}</th>
</tr>
<tr>
{% if not voteinfo.is_running() %}
<td>{{ voteinfo.Yes }}</td>
<td>{{ voteinfo.No }}</td>
<td>{{ voteinfo.Abstain }}</td>
{% endif %}
<td>{{ voteinfo.total_votes() }}</td>
<td>
{% if not has_voted %}
<span style="color: red; font-weight: bold">
{{ "No" | tr }}
</span>
{% else %}
<span style="color: green; font-weight: bold">
{{ "Yes" | tr }}
</span>
{% endif %}
</td>
<td>
{% if voteinfo.ActiveTUs %}
{{ (participation * 100) | number_format(2) }}%
{% else %}
{{ "unknown" | tr }}
{% endif %}
</td>
</tr>
</table>