mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-20 14:47:58 +01:00
87eabaa48f
These were largely found with three regular expressions: %> [.;,] ( <% %> \w+ <
45 lines
1.6 KiB
Text
45 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>
|