mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-21 06:58:00 +01:00
55 lines
1.6 KiB
Text
55 lines
1.6 KiB
Text
|
<div class="poll-results">
|
||
|
<h4 class="poll__header">
|
||
|
Poll results:
|
||
|
<%= @poll.title %>
|
||
|
</h4>
|
||
|
<div class="poll-option-list">
|
||
|
<%
|
||
|
winning = winning_option(@poll)
|
||
|
winners? = @poll.total_votes > 0
|
||
|
%>
|
||
|
<%= for option <- ranked_options(@poll) do %>
|
||
|
<div class={option_class(option, winning, winners?)}>
|
||
|
<div class="poll-option__text">
|
||
|
<span class="poll-option__label">
|
||
|
<%= option.label %>
|
||
|
</span>
|
||
|
<div class="poll-option__counts">
|
||
|
<span>
|
||
|
<%= percent_of_total(option, @poll) %>
|
||
|
<%= option.vote_count %>
|
||
|
<%= pluralize("vote", "votes", option.vote_count) %>
|
||
|
</span>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="poll-bar">
|
||
|
<svg class="poll-bar__image" height="100%" preserveAspectRatio="none" viewBox="0 0 1 1" width={percent_of_total(option, @poll)}>
|
||
|
<rect class={poll_bar_class(option, winning, winners?)} height="1" width="1"></rect>
|
||
|
</svg>
|
||
|
</div>
|
||
|
</div>
|
||
|
<% end %>
|
||
|
<p>
|
||
|
<%= if active?(@poll) do %>
|
||
|
Poll ends
|
||
|
<%= pretty_time(@poll.active_until) %>
|
||
|
.
|
||
|
<%= if @poll.total_votes > 0 do %>
|
||
|
<%= @poll.total_votes %>
|
||
|
<%= pluralize("vote", "votes", @poll.total_votes) %>
|
||
|
<% else %>
|
||
|
No votes have been
|
||
|
<% end %>
|
||
|
cast so far.
|
||
|
<% else %>
|
||
|
Poll ended
|
||
|
<%= pretty_time(@poll.active_until) %>
|
||
|
with
|
||
|
<%= @poll.total_votes %>
|
||
|
<%= pluralize("vote", "votes", @poll.total_votes) %>
|
||
|
.
|
||
|
<% end %>
|
||
|
</p>
|
||
|
</div>
|
||
|
</div>
|