Add headings for advanced statistics

This commit is contained in:
Javi Martín
2019-01-04 17:19:47 +01:00
parent 90fe746d27
commit a9bb3eba26
3 changed files with 89 additions and 68 deletions

View File

@@ -8,79 +8,94 @@
<div class="row margin" data-equalizer data-equalize-on="medium">
<div class="small-12 medium-3 column sidebar" data-equalizer-watch>
<%= render "shared/stats/links" %>
<p><strong><%= link_to t("stats.advanced"), "#advanced_statistics" %></strong></p>
<ul class="menu vertical">
<li>
<%= link_to t("stats.polls.vote_by_channel"), "#vote_stats_by_channel" %>
</li>
</ul>
</div>
<div class="small-12 medium-9 column" data-equalizer-watch>
<%= render "shared/stats/participation", stats: @stats %>
<table class="stack">
<thead>
<tr>
<th scope="col"><%= t("polls.show.stats.votes") %></th>
<th scope="col"><%= t("polls.show.stats.web") %></th>
<th scope="col"><%= t("polls.show.stats.booth") %></th>
<th scope="col"><%= t("polls.show.stats.total") %></th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row"><%= t("polls.show.stats.valid") %></th>
<td>
<%= @stats[:total_web_valid] %>
<small><em>(<%= @stats[:valid_percentage_web].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_booth_valid] %>
<small><em>(<%= @stats[:valid_percentage_booth].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_valid_votes] %>
<small><em>(<%= @stats[:total_valid_percentage].round(2) %>%)</em></small>
</td>
</tr>
<tr>
<th scope="row"><%= t("polls.show.stats.white") %></th>
<td>
<%= @stats[:total_web_white] %>
<small><em>(<%= @stats[:white_percentage_web].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_booth_white] %>
<small><em>(<%= @stats[:white_percentage_booth].round(2) %>%)</em></small>
</td>
<td><%= @stats[:total_white_votes] %>
<small><em>(<%= @stats[:total_white_percentage].round(2) %>%)</em></small>
</td>
</tr>
<tr>
<th scope="row"><%= t("polls.show.stats.null_votes") %></th>
<td>
<%= @stats[:total_web_null] %>
<small><em>(<%= @stats[:null_percentage_web].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_booth_null] %>
<small><em>(<%= @stats[:null_percentage_booth].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_null_votes] %>
<small><em>(<%= @stats[:total_null_percentage].round(2) %>%)</em></small>
</td>
</tr>
<tr>
<th scope="row"><%= t("polls.show.stats.total") %></th>
<td>
<%= @stats[:total_participants_web] %>
<small><em>(<%= @stats[:total_participants_web_percentage].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_participants_booth] %>
<small><em>(<%= @stats[:total_participants_booth_percentage].round(2) %>%)</em></small>
</td>
<td><%= @stats[:total_participants] %></td>
</tr>
</tbody>
</table>
<div id="advanced_statistics">
<h3 class="section-title"><%= t("stats.advanced") %></h3>
<div id="vote_stats_by_channel" class="stats-group">
<h4><%= t("stats.polls.vote_by_channel") %></h4>
<table class="stack">
<thead>
<tr>
<th scope="col"><%= t("polls.show.stats.votes") %></th>
<th scope="col"><%= t("polls.show.stats.web") %></th>
<th scope="col"><%= t("polls.show.stats.booth") %></th>
<th scope="col"><%= t("polls.show.stats.total") %></th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row"><%= t("polls.show.stats.valid") %></th>
<td>
<%= @stats[:total_web_valid] %>
<small><em>(<%= @stats[:valid_percentage_web].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_booth_valid] %>
<small><em>(<%= @stats[:valid_percentage_booth].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_valid_votes] %>
<small><em>(<%= @stats[:total_valid_percentage].round(2) %>%)</em></small>
</td>
</tr>
<tr>
<th scope="row"><%= t("polls.show.stats.white") %></th>
<td>
<%= @stats[:total_web_white] %>
<small><em>(<%= @stats[:white_percentage_web].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_booth_white] %>
<small><em>(<%= @stats[:white_percentage_booth].round(2) %>%)</em></small>
</td>
<td><%= @stats[:total_white_votes] %>
<small><em>(<%= @stats[:total_white_percentage].round(2) %>%)</em></small>
</td>
</tr>
<tr>
<th scope="row"><%= t("polls.show.stats.null_votes") %></th>
<td>
<%= @stats[:total_web_null] %>
<small><em>(<%= @stats[:null_percentage_web].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_booth_null] %>
<small><em>(<%= @stats[:null_percentage_booth].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_null_votes] %>
<small><em>(<%= @stats[:total_null_percentage].round(2) %>%)</em></small>
</td>
</tr>
<tr>
<th scope="row"><%= t("polls.show.stats.total") %></th>
<td>
<%= @stats[:total_participants_web] %>
<small><em>(<%= @stats[:total_participants_web_percentage].round(2) %>%)</em></small>
</td>
<td>
<%= @stats[:total_participants_booth] %>
<small><em>(<%= @stats[:total_participants_booth_percentage].round(2) %>%)</em></small>
</td>
<td><%= @stats[:total_participants] %></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>