forked from consuldemocracy/consuldemocracy
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bdd8c80
commit 7ae50da
Showing
12 changed files
with
230 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,38 @@ | ||
<div id="participants_by_age" class="stats-group"> | ||
<h4><%= t("stats.by_age") %></h4> | ||
<% if !budget_stats.blank?%> | ||
<%else%> | ||
<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.male") %></th> | ||
<th><%= t("stats.female") %></th> | ||
<th><%= t("stats.other") %></th> | ||
<th><%= t("stats.total") %></th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
<% stats.participants_by_age.values.each do |group| %> | ||
<table> | ||
<thead> | ||
<tr> | ||
<td><%= group[:range] %></td> | ||
<td><%= group[:male] %></td> | ||
<td><%= group[:female] %></td> | ||
<td><%= group[:other] %></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> | ||
<th class="small-4"><%= t("stats.age") %></th> | ||
<th><%= t("stats.male") %></th> | ||
<th><%= t("stats.female") %></th> | ||
<th><%= t("stats.other") %></th> | ||
<th><%= t("stats.total") %></th> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</div> | ||
</thead> | ||
|
||
<tbody> | ||
<% stats.participants_by_age.values.each do |group| %> | ||
<tr> | ||
<td><%= group[:range] %></td> | ||
<td><%= group[:male] %></td> | ||
<td><%= group[:female] %></td> | ||
<td><%= group[:other] %></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> | ||
<%end%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,41 @@ | ||
<div id="participants_by_gender" class="stats-group"> | ||
<h4><%= t("stats.by_gender") %></h4> | ||
<% if !budget_stats.blank?%> | ||
<div id="participants_by_gender" class="stats-group"> | ||
<h4><%= t("stats.by_gender") %></h4> | ||
|
||
<%= number_with_info_tags( | ||
stats.participants.where("upper(gender) = upper('male')").count, | ||
t("stats.men_percentage", percentage: number_to_stats_percentage(stats.participants.where("upper(gender) = upper('male')").count.to_f/stats.participants.count.to_f*100 )), | ||
html_class: "participants male" | ||
) %> | ||
<%= number_with_info_tags( | ||
budget_stats.find_by(name: 'total_male_participants', budget: @budget.id).try(:value).to_i, | ||
t("stats.male_percentage", percentage: number_to_stats_percentage(budget_stats.find_by(name: 'total_male_participants', budget: @budget.id).try(:value).to_f/budget_stats.find_by(name: 'total_participants', budget: @budget.id).try(:value).to_f*100 )), | ||
html_class: "participants male" | ||
) %> | ||
<%= number_with_info_tags( | ||
stats.participants.where("upper(gender) = upper('female')").count, | ||
t("stats.women_percentage", percentage: number_to_stats_percentage(stats.participants.where("upper(gender) = upper('female')").count.to_f/stats.participants.count.to_f*100)), | ||
html_class: "participants female" | ||
) %> | ||
<%= number_with_info_tags( | ||
stats.participants.where("gender is null or gender = ''").count, | ||
t("stats.other_percentage", percentage: number_to_stats_percentage(stats.participants.where("gender is null or gender = ''").count.to_f/stats.participants.count.to_f*100)) | ||
) %> | ||
</div> | ||
<%= number_with_info_tags( | ||
budget_stats.find_by(name: 'total_female_participants', budget: @budget.id).try(:value).to_i, | ||
t("stats.female_percentage", percentage: number_to_stats_percentage(budget_stats.find_by(name: 'total_female_participants', budget: @budget.id).try(:value).to_f/budget_stats.find_by(name: 'total_participants', budget: @budget.id).try(:value).to_f*100)), | ||
html_class: "participants female" | ||
) %> | ||
<%= number_with_info_tags( | ||
budget_stats.find_by(name: 'total_other_participants', budget: @budget.id).try(:value).to_i, | ||
t("stats.other_percentage", percentage: number_to_stats_percentage(budget_stats.find_by(name: 'total_other_participants', budget: @budget.id).try(:value).to_f/budget_stats.find_by(name: 'total_participants', budget: @budget.id).try(:value).to_f*100)) | ||
) %> | ||
</div> | ||
<%else%> | ||
<div id="participants_by_gender" class="stats-group"> | ||
<h4><%= t("stats.by_gender") %></h4> | ||
|
||
<%= number_with_info_tags( | ||
stats.participants.where("upper(gender) = upper('male')").count, | ||
t("stats.men_percentage", percentage: number_to_stats_percentage(stats.participants.where("upper(gender) = upper('male')").count.to_f/stats.participants.count.to_f*100 )), | ||
html_class: "participants male" | ||
) %> | ||
<%= number_with_info_tags( | ||
stats.participants.where("upper(gender) = upper('female')").count, | ||
t("stats.women_percentage", percentage: number_to_stats_percentage(stats.participants.where("upper(gender) = upper('female')").count.to_f/stats.participants.count.to_f*100)), | ||
html_class: "participants female" | ||
) %> | ||
<%= number_with_info_tags( | ||
stats.participants.where("gender is null or gender = ''").count, | ||
t("stats.other_percentage", percentage: number_to_stats_percentage(stats.participants.where("gender is null or gender = ''").count.to_f/stats.participants.count.to_f*100)) | ||
) %> | ||
</div> | ||
<%end%> |
Oops, something went wrong.