Merge pull request #3512 from consul/backport-stats
Change stats layout
This commit is contained in:
28
app/views/shared/stats/_age.html.erb
Normal file
28
app/views/shared/stats/_age.html.erb
Normal file
@@ -0,0 +1,28 @@
|
||||
<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.participants_by_age.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>
|
||||
15
app/views/shared/stats/_gender.html.erb
Normal file
15
app/views/shared/stats/_gender.html.erb
Normal file
@@ -0,0 +1,15 @@
|
||||
<div id="participants_by_gender" class="stats-group">
|
||||
<h4><%= t("stats.by_gender") %></h4>
|
||||
|
||||
<%= number_with_info_tags(
|
||||
stats.total_male_participants,
|
||||
t("stats.men_percentage", percentage: number_to_stats_percentage(stats.male_percentage)),
|
||||
html_class: "participants male"
|
||||
) %>
|
||||
|
||||
<%= number_with_info_tags(
|
||||
stats.total_female_participants,
|
||||
t("stats.women_percentage", percentage: number_to_stats_percentage(stats.female_percentage)),
|
||||
html_class: "participants female"
|
||||
) %>
|
||||
</div>
|
||||
21
app/views/shared/stats/_geozone.html.erb
Normal file
21
app/views/shared/stats/_geozone.html.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
<div id="participants_by_geozone" class="stats-group">
|
||||
<h4><%= t("stats.by_geozone") %></h4>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("stats.geozone") %></th>
|
||||
<th><%= t("stats.total") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% stats.participants_by_geozone.each do |geozone, participants| %>
|
||||
<tr>
|
||||
<td><%= geozone %></td>
|
||||
<td><%= "#{participants[:count]} (#{number_to_stats_percentage(participants[:percentage])})" %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
12
app/views/shared/stats/_links.html.erb
Normal file
12
app/views/shared/stats/_links.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<p><strong><%= link_to t("stats.title"), "#participation_statistics" %></strong></p>
|
||||
<ul class="menu vertical">
|
||||
<li>
|
||||
<%= link_to t("stats.total_participants"), "#total_participants" %>
|
||||
</li>
|
||||
|
||||
<% stats.participations.each do |stat| %>
|
||||
<li>
|
||||
<%= link_to t("stats.by_#{stat}"), "#participants_by_#{stat}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
17
app/views/shared/stats/_participation.html.erb
Normal file
17
app/views/shared/stats/_participation.html.erb
Normal file
@@ -0,0 +1,17 @@
|
||||
<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>
|
||||
|
||||
<%= number_with_info_tags(
|
||||
stats.total_participants,
|
||||
"",
|
||||
html_class: "participants total-participants"
|
||||
) %>
|
||||
</div>
|
||||
|
||||
<% stats.participations.each do |participation| %>
|
||||
<%= render "shared/stats/#{participation}", stats: stats %>
|
||||
<% end %>
|
||||
</div>
|
||||
Reference in New Issue
Block a user