From 6899ba9a9f5ce76d4442bfdc033a741ffa517220 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 30 Jun 2017 12:08:44 +0200 Subject: [PATCH] Complete Budget Stats view with translations --- app/assets/images/budgets/stats/gender.png | Bin 0 -> 4133 bytes app/views/budgets/stats/show.html.erb | 142 ++++++++++++--------- config/locales/en/budgets.yml | 31 +++++ config/locales/es/budgets.yml | 31 +++++ 4 files changed, 147 insertions(+), 57 deletions(-) create mode 100644 app/assets/images/budgets/stats/gender.png diff --git a/app/assets/images/budgets/stats/gender.png b/app/assets/images/budgets/stats/gender.png new file mode 100644 index 0000000000000000000000000000000000000000..e4179354caaca1fec82a09bd98b3867a8f7f71a8 GIT binary patch literal 4133 zcmaJ@c|2788b7uciM;KTm_}*EU>GxuZ6<4$WQ)RJFlNR~3}Xzbv`A&iR+dy`C&E;S z@|GpxO^jhIud+m0Qns?(bKL6QKi+%ik2B}|KF{-gw(s*izpGXjMjORp;s5|_G%+Sv z1Awp-`0lz+7<@js1Sf)jJDEovm?!9-Ocv3P1n7Iv-AHf~8qtenO(J@*&oq*>0YKyc z*~WqCV15kiPNyjmAsMA08Uxe@0BzkM2GN~DV#3`>USwY!VzROZ0VjLl5ccZkNOK0B z>%1ZUx8F{YY?iB@IP)qy`#}#we+%qtPhz5x6Q+MO_)GrmTikR8_;GkXV!|{O1n= zTJ!Vp#99*!f7$}Sa0qWElYv!MX0cdGEHx#%pO>-<27^&Xsw%6hDuNP<{%l_+F-XzZ zU;Y;Yf#mP*M`kd|bYD1xNOYqIFmVXb(|?CRW0;%&2KM#;nJ6%2%0WbivWgN?nMQ-+ zT9x)^T9f|c#y?8?+prlVWowc@J;2W$tcR!kFJ&-y|KAWK2zrAh(A@)QBwwZp0fzuj zlsw2DSPis>zJ?(ZrDll6sHhy(z~GU1yc$YhU0oHWhSpU5rEB8r&m{V~lYZ%v|D&t+ ze|52VKN68i_p_nXslTdcgk-)D00obv^ze`k%V`|5H~P zbVeB}?|+s1*Ad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2>C=jLw0<$jW!iOO%!rFd0pOi&JKQ4CbD%H&L0KTcS)rTza5l^xE$JS{Eqj <% provide :title, t("spending_proposals.stats.page_title") %> <% provide :social_media_meta_tags do %> - <%= render "shared/social_media_meta_tags_participatory_budget" %> + <%= render "shared/social_media_meta_tags", + social_url: budget_url(@budget), + social_title: @budget.name, + social_description: @budget.description_finished %> <% end %> <%= javascript_include_tag "chart", "data-turbolinks-track" => true %> - <%= javascript_include_tag "participatory-budget-charts", "data-turbolinks-track" => true %> + <%= javascript_include_tag "budgets-stats-charts", "data-turbolinks-track" => true %>
- <%= back_link_to participatory_budget_path %> + <%= back_link_to budgets_path %>

<%= t("spending_proposals.stats.heading") %>

@@ -21,11 +24,11 @@
  • - <%= link_to t("spending_proposals.stats.results_link"), participatory_budget_results_path %> + <%= link_to t("budget.results.link"), budget_results_path(@budget) %>
  • <%= t("shared.you_are_in") %> - <%= link_to t("spending_proposals.stats.stats_link"), participatory_budget_stats_path, class: "is-active" %> + <%= link_to t("budgets.stats.link"), budget_stats_path(@budget), class: "is-active" %>
@@ -34,7 +37,7 @@
-

TOTAL PARTICIPANTES

+

<%= t("budgets.stats.total_participants").upcase %>

<%= @stats[:total_participants] %>

@@ -47,9 +50,9 @@
-

TOTAL PROPUESTAS ENVIADAS

+

<%= t("budgets.stats.total_budget_investments").upcase %>

- <%= @stats[:total_spending_proposals] + @stats[:paper_spending_proposals] %> + <%= @stats[:total_budget_investments] %>

@@ -58,34 +61,34 @@

  - PROPUESTAS EN LA FASE FINAL: - <%= @stats[:total_feasible_spending_proposals] %>
+ <%= t("budgets.stats.total_feasible_investments").upcase %>: + <%= @stats[:total_feasible_investments] %>
  - PROPUESTAS INVIABLES: - <%= @stats[:total_unfeasible_spending_proposals] %>
+ <%= t("budgets.stats.total_unfeasible_investments").upcase %>: + <%= @stats[:total_unfeasible_investments] %>

  - FASE DE APOYOS: + <%= t("budgets.stats.total_participants_support_phase").upcase %>: - <%= @stats[:total_participants_support_phase] %> Participantes, + <%= @stats[:total_participants_support_phase] %> <%= t("budgets.stats.participants") %>, - <%= @stats[:total_supports] %> Apoyos
+ <%= @stats[:total_supports] %> <%= t("budgets.stats.supports") %>
  - FASE DE VOTACIÓN: + <%= t("budgets.stats.total_participants_vote_phase").upcase %>: - <%= @stats[:total_participants_vote_phase] %> Participantes, + <%= @stats[:total_participants_vote_phase] %> <%= t("budgets.stats.participants") %>, - <%= @stats[:total_votes] %> Votos
+ <%= @stats[:total_votes] %> <%= t("budgets.stats.votes") %>

@@ -95,19 +98,18 @@
-
-

Participación
por sexo

+

<%= t("budgets.stats.by_gender") %>


- <%= image_tag ("participatory_budget_stats/sex.png") %> + <%= image_tag ("budgets/stats/gender.png") %>
- +
@@ -117,7 +119,7 @@

-  HOMBRES +  <%= t("budgets.stats.total_male_participants").upcase %> (<%= number_to_percentage(@stats[:male_percentage], strip_insignificant_zeros: true, precision: 2) %>) @@ -132,7 +134,7 @@

-  MUJERES +  <%= t("budgets.stats.total_female_participants").upcase %> (<%= number_to_percentage(@stats[:female_percentage], strip_insignificant_zeros: true, precision: 2) %>) @@ -148,12 +150,46 @@

-

Participación por
grupos de edad

+

<%= t("budgets.stats.by_age") %>


- <%= render "spending_proposals_results_age" %> + + + + + + + + + <% all_ages_count = @stats[:age_groups].values.sum.to_f %> + <% @stats[:age_groups].each do |age_group, count| %> + "> + + + + <% end %> + +
<%= t("budgets.stats.age").upcase %><%= t("budgets.stats.total").upcase %>
+ <%= age_group.gsub("+", t("budgets.stats.more_than")) + t("budgets.stats.years") %> + + + <% + percentage_age_count = all_ages_count == 0 ? 0 : (count / all_ages_count * 100) + formatted_percentage_age_count = number_to_percentage(percentage_age_count, + strip_insignificant_zeros: true, + precision: 2) + %> + <%= count %> + (<%= formatted_percentage_age_count %>) + +
+ +
+

@@ -161,62 +197,56 @@
-

Participación por
distritos

-
- -
- -
- <%= image_tag("map.jpg", usemap: "#html_map", alt: "Mapa de distritos de Madrid") %> +

<%= t("budgets.stats.by_heading") %>

- - - - - + + + + + - - - - - - - - - + + + + + + + + + - <% @stats.headings.each do |heading| %> + <% @budget.headings.each do |heading| %> <% ["support", "vote", "all"].each do |phase| %>
DISTRITOPROPUESTAS ENVIADASPARTICIPACIÓN FASE APOYOSPARTICIPACIÓN FASE VOTACIÓNPARTICIPACIÓN TOTAL<% t("budgets.stats.heading").upcase %><% t("budgets.stats.investments_sent").upcase %><% t("budgets.stats.participants_support_phase").upcase %><% t("budgets.stats.participants_voting_phase").upcase %><% t("budgets.stats.participants_total").upcase %>
TOTAL%
TOTAL
PARTICIPANTES
%
CENSO
DISTRITO
TOTAL%
TOTAL
PARTICIPANTES
%
CENSO
DISTRITO
TOTAL%
TOTAL
PARTICIPANTES
%
CENSO
DISTRITO
<%= t("budgets.stats.total").upcase %><%= t("budgets.stats.percent_total_participants").upcase %><%= t("budgets.stats.percent_heading_census").upcase %><%= t("budgets.stats.total").upcase %><%= t("budgets.stats.percent_total_participants").upcase %><%= t("budgets.stats.percent_heading_census").upcase %><%= t("budgets.stats.total").upcase %><%= t("budgets.stats.percent_total_participants").upcase %><%= t("budgets.stats.percent_heading_census").upcase %>
<%= heading.name %> - <%= heading.spending_proposals.count %> + <%= heading.investments.count %> + class="border-left text-center <%= phase == "all" ? "success" : "" %>"> <%= @stats[:headings][heading.id]["total_participants_#{phase}_phase".to_sym] %> + class="border-left border-right text-center <%= phase == "all" ? "success" : "" %>"> <%= number_to_percentage(@stats[:headings][heading.id]["percentage_participants_#{phase}_phase".to_sym], strip_insignificant_zeros: true, precision: 2) %> + class="text-center <%= phase == "all" ? "success" : "" %>"> <%= number_to_percentage(@stats[:headings][heading.id]["percentage_district_population_#{phase}_phase".to_sym], strip_insignificant_zeros: true, precision: 2) %> @@ -231,17 +261,15 @@

- * No se dispone de los datos demográficos de - <%= @stats[:total_unknown_gender_or_age] %> - participantes. + <%= t("budgets.stats.no_demographic_data", total: @stats[:total_unknown_gender_or_age]) %>
- ** Las cifras de participación total se refieren a personas que han creado, apoyado o votado propuestas. + <%= t("budgets.stats.participatory_disclaimer") %>
- *** Los datos de distrito se refieren al distrito en el que el usuario ha votado, no necesariamente en el que está empadronado. + <%= t("budgets.stats.heading_disclaimer") %>

diff --git a/config/locales/en/budgets.yml b/config/locales/en/budgets.yml index d7bd7235d..2002d54ea 100644 --- a/config/locales/en/budgets.yml +++ b/config/locales/en/budgets.yml @@ -191,3 +191,34 @@ en: dates_range_invalid: "Start date can't be equal or later than End date" prev_phase_dates_invalid: "Start date must be later than the start date of the previous enabled phase (%{phase_name})" next_phase_dates_invalid: "End date must be earlier than the end date of the next enabled phase (%{phase_name})" + stats: + link: Stats + page_title: "%{budget} - Stats" + total_participants: Total Participants + total_budget_investments: Total Proposed Investments + total_feasible_investments: Proposals on final phase + total_unfeasible_investments: Unfeasible proposals + total_participants_support_phase: Support phase + participants: Participants + supports: Supports + votes: Votes + total_participants_vote_phase: Voting Phase + by_gender: "Participants
by sex" + total_male_participants: Mens + total_female_participants: Women + by_age: "Participants by
age groups" + age: Age + total: Total + more_than: More than + years: years + by_heading: "Participants by
heading" + heading: Heading + investments_sent: Investment proposals sent + participants_support_phase: Participants support phase + participants_voting_phase: Participants voting phase + participants_total: Total Participants + percent_total_participants: "%
Total
Participants" + percent_heading_census: "%
Heading
Census" + no_demographic_data: "* There is no demographic data for
%{total}
participants." + participatory_disclaimer: "** The numbers of total participation refer to persons that created, supported or voted investment proposals." + heading_disclaimer: "*** Data about headings refer to the heading where each user voted, not necessarily the one that person is registered on." diff --git a/config/locales/es/budgets.yml b/config/locales/es/budgets.yml index 982149b5a..5fefc3430 100644 --- a/config/locales/es/budgets.yml +++ b/config/locales/es/budgets.yml @@ -191,3 +191,34 @@ es: dates_range_invalid: "La fecha de comienzo no puede ser igual o superior a la de finalización" prev_phase_dates_invalid: "La fecha de inicio debe ser posterior a la fecha de inicio de la anterior fase habilitada (%{phase_name})" next_phase_dates_invalid: "La fecha de fin debe ser anterior a la fecha de fin de la siguiente fase habilitada (%{phase_name})" + stats: + link: Estadísticas + page_title: "%{budget} - Estadísticas" + total_participants: Total participantes + total_budget_investments: Total propuestas enviadas + total_feasible_investments: Propuestas en la fase final + total_unfeasible_investments: Propuestas inviables + total_participants_support_phase: Fase de apoyos + participants: Participantess + supports: Apoyos + votes: Votos + total_participants_vote_phase: Fase de votación + total: Total + by_gender: "Participación
por sexo" + total_male_participants: Hombres + total_female_participants: Mujeres + by_age: "Participación por
grupos de edad" + age: Edad + more_than: Más de + years: años + by_heading: "Participación por
distritos" + heading: Distrito + investments_sent: Propuestas enviadas + participants_support_phase: Participación fase apoyos + participants_voting_phase: Participación fase apoyos + participants_total: Participación fase apoyos + percent_total_participants: "%
Total
Participantes" + percent_heading_census: "%
Censo
Distrito" + no_demographic_data: "* No se dispone de los datos demográficos de
%{total}
participantes." + participatory_disclaimer: "** Las cifras de participación total se refieren a personas que han creado, apoyado o votado propuestas." + heading_disclaimer: "*** Los datos de distrito se refieren al distrito en el que el usuario ha votado, no necesariamente en el que está empadronado."