Files
grecia/app/views/budgets/stats/show.html.erb
Javi Martín 6ad3bc063c Move budget stats translations to stats files
We were using custom translations, but now this code is going to be
included in the main CONSUL repository.
2019-05-21 13:50:17 +02:00

171 lines
7.5 KiB
Plaintext

<% provide :title do %>
<%= t("stats.budgets.page_title", budget: @budget.name) %>
<% end %>
<% provide :social_media_meta_tags do %>
<%= render "shared/social_media_meta_tags",
social_url: budget_url(@budget),
social_title: @budget.name,
social_description: @budget.description_finished %>
<% end %>
<% cache [@stats] do %>
<div class="participation-stats budgets-stats">
<div class="expanded no-margin-top padding header">
<div class="row">
<div class="small-12 column">
<%= back_link_to budgets_path %>
<h2 class="margin-top">
<%= t("stats.title") %><br>
<span><%= @budget.name %></span>
</h2>
</div>
</div>
</div>
<div class="row margin-top">
<div class="small-12 column">
<ul class="tabs">
<li class="tabs-title">
<span class="show-for-sr"><%= t("shared.you_are_in") %></span>
<%= link_to t("budgets.results.link"), budget_results_path(@budget) %>
</li>
<li class="tabs-title is-active">
<%= link_to t("stats.budgets.link"), budget_stats_path(@budget), class: "is-active" %>
</li>
<li class="tabs-title">
<%= link_to t("budgets.executions.link"), budget_executions_path(@budget) %>
</li>
</ul>
</div>
</div>
<main>
<div class="small-12 medium-3 sidebar">
<%= render "shared/stats/links" %>
<p><strong><%= link_to t("stats.advanced"), "#advanced_statistics" %></strong></p>
<ul class="menu vertical">
<li>
<%= link_to t("stats.budgets.total_investments"), "#total_investments"%>
</li>
<li>
<%= link_to t("stats.budgets.total_participants_support_phase"), "#stats_by_phase"%>
</li>
<li>
<%= link_to t("stats.budgets.by_heading"), "#stats_by_heading"%>
</li>
</ul>
</div>
<div class="small-12 medium-9">
<%= render "shared/stats/participation", stats: @stats %>
<div id="advanced_statistics">
<h3 class="section-title"><%= t("stats.advanced") %></h3>
<div id="total_investments" class="stats-group">
<h4><%= t("stats.budgets.total_investments") %></h4>
<%= number_with_info_tags(
@stats[:total_budget_investments],
t("stats.budgets.total_investments"),
html_class: "total-investments"
) %>
<%= number_with_info_tags(@stats[:total_selected_investments],
t("stats.budgets.total_selected_investments")) %>
<%= number_with_info_tags(@stats[:total_unfeasible_investments],
t("stats.budgets.total_unfeasible_investments")) %>
</div>
<div id="stats_by_phase" class="stats-group">
<h4><%= t("stats.budgets.total_participants_support_phase") %></h4>
<%= number_with_info_tags(@stats[:total_participants_support_phase],
t("stats.budgets.participants")) %>
<%= number_with_info_tags(@stats[:total_supports], t("stats.budgets.supports")) %>
<%= number_with_info_tags(@stats[:total_participants_web],
t("stats.budgets.total_participants_web")) %>
<%= number_with_info_tags(@stats[:total_participants_booths],
t("stats.budgets.total_participants_booths")) %>
</div>
<div id="stats_by_heading" class="stats-group">
<h4 class="margin-bottom"><%= t("stats.budgets.by_heading") %></h4>
<table class="stats-districts survey-districts">
<thead>
<tr>
<th scope="col" rowspan="2"><%= t("stats.budgets.heading") %></th>
<th scope="col" rowspan="2"><%= t("stats.budgets.investments_sent_html") %></th>
<th scope="col" colspan="3"><%= t("stats.budgets.participants_support_phase") %></th>
<th scope="col" colspan="3"><%= t("stats.budgets.participants_voting_phase") %></th>
<th scope="col" colspan="3"><%= t("stats.budgets.participants_total") %></th>
</tr>
<tr>
<th scope="col" class="tiny"><%= t("stats.budgets.total") %></th>
<th scope="col" class="tiny"><%= t("stats.budgets.percent_total_participants_html") %></th>
<th scope="col" class="tiny"><%= t("stats.budgets.percent_heading_census_html") %></th>
<th scope="col" class="tiny"><%= t("stats.budgets.total") %></th>
<th scope="col" class="tiny"><%= t("stats.budgets.percent_total_participants_html") %></th>
<th scope="col" class="tiny"><%= t("stats.budgets.percent_heading_census_html") %></th>
<th scope="col" class="tiny"><%= t("stats.budgets.total") %></th>
<th scope="col" class="tiny"><%= t("stats.budgets.percent_total_participants_html") %></th>
<th scope="col" class="tiny"><%= t("stats.budgets.percent_heading_census_html") %></th>
</tr>
</thead>
<tbody id="headings">
<% @headings.each do |heading| %>
<tr id="<%= heading.name.parameterize %>">
<td class="border-left">
<strong><%= heading.name %></strong>
</td>
<td id="total_spending_proposals_heading_<%= heading.id %>"
class="text-center border-left border-right">
<%= @stats[:headings][heading.id][:total_investments_count] %>
</td>
<% ["support", "vote", "all"].each do |phase| %>
<td id="total_participants_<%= phase %>_phase_heading_<%= heading.id %>"
class="border-left text-center">
<%= @stats[:headings][heading.id]["total_participants_#{phase}_phase".to_sym] %>
</td>
<td id="percentage_participants_<%= phase %>_phase_heading_<%= heading.id %>"
class="border-left border-right text-center">
<%= number_to_stats_percentage(@stats[:headings][heading.id]["percentage_participants_#{phase}_phase".to_sym]) %>
</td>
<td id="percentage_district_population_<%= phase %>_phase_heading_<%= heading.id %>"
class="text-center border-right">
<%= number_to_stats_percentage(@stats[:headings][heading.id]["percentage_district_population_#{phase}_phase".to_sym]) %>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="row margin">
<div class="small-12 column">
<div id="total_unknown_gender_or_age">
<p class="help-text">
<%= t("stats.budgets.no_demographic_data", total: @stats[:total_unknown_gender_or_age]) %>
</p>
<p class="help-text">
<%= t("stats.budgets.participatory_disclaimer") %>
</p>
<p class="help-text">
<%= t("stats.budgets.heading_disclaimer") %>
</p>
</div>
</div>
</div>
</div>
</main>
</div>
<% end %>