Files
grecia/app/views/shared/stats/_participation.html.erb
2019-05-21 13:50:16 +02:00

63 lines
1.9 KiB
Plaintext

<div id="participation_statistics">
<h3 class="section-title"><%= t("stats.title") %></h3>
<div id="total_participants" class="stats-group">
<h4><%= t("stats.total_participants") %></h4>
<p class="participants">
<span class="number"><%= stats[:total_participants] %></span>
<span class="info"><%= t("polls.show.stats.total_votes") %></span>
</p>
</div>
<div id="participants_by_gender" class="stats-group">
<h4><%= t("stats.by_gender") %></h4>
<p class="gender male participants">
<span class="number"><%= stats[:total_male_participants] %></span>
<span class="info">
<%= I18n.t("stats.men_percentage",
percentage: number_to_stats_percentage(stats[:male_percentage])) %>
</span>
</p>
<p class="gender female participants">
<span class="number"><%= stats[:total_female_participants] %></span>
<span class="info">
<%= I18n.t("stats.women_percentage",
percentage: number_to_stats_percentage(stats[:female_percentage])) %>
</span>
</p>
</div>
<div id="participants_by_age" class="stats-group">
<h4><%= t("stats.by_age") %></h4>
<table>
<thead>
<tr>
<th class="small-4"><%= t("stats.age") %></th>
<th><%= t("stats.total") %></th>
</tr>
</thead>
<tbody>
<% stats[:age_groups].values.each do |group| %>
<tr>
<td><%= group[:range] %></td>
<td>
<strong>
<%= "#{group[:count]} (#{number_to_stats_percentage(group[:percentage])})" %>
</strong>
<div class="progress" tabindex="0">
<span class="progress-meter" style="width: <%= group[:percentage] %>%">
</span>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>