diff --git a/app/views/budgets/stats/show.html.erb b/app/views/budgets/stats/show.html.erb index f95311022..89666053f 100644 --- a/app/views/budgets/stats/show.html.erb +++ b/app/views/budgets/stats/show.html.erb @@ -1,5 +1,7 @@ <% cache [@stats] do %> - <% provide :title, t("spending_proposals.stats.page_title") %> + <% provide :title do %> + <%= t("budgets.stats.title") %> - <%= @budget.name %> + <% end %> <% provide :social_media_meta_tags do %> <%= render "shared/social_media_meta_tags", social_url: budget_url(@budget), @@ -7,246 +9,210 @@ social_description: @budget.description_finished %> <% end %> - <%= javascript_include_tag "chart", "data-turbolinks-track" => true %> - <%= javascript_include_tag "budgets-stats-charts", "data-turbolinks-track" => true %> - -
-
-
-
- <%= back_link_to budgets_path %> -

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

-
-
-
- -
-
-
    -
  • - <%= link_to t("budget.results.link"), budget_results_path(@budget) %> -
  • -
  • - <%= t("shared.you_are_in") %> - <%= link_to t("budgets.stats.link"), budget_stats_path(@budget), class: "is-active" %> -
  • -
-
-
- -
-
-
-

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

-

- <%= @stats[:total_participants] %> -

-
-
-
- -
- -
-
-
-

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

-

- <%= @stats[:total_budget_investments] %> -

+
+
+
+
+ <%= back_link_to budgets_path %> +

<%= t("budgets.stats.title") %>
<%= @budget.name %>

+
-
-

-   - - <%= t("budgets.stats.total_feasible_investments").upcase %>: - <%= @stats[:total_feasible_investments] %>
-
- -   - - <%= t("budgets.stats.total_unfeasible_investments").upcase %>: - <%= @stats[:total_unfeasible_investments] %>
-
- -
- -   - <%= t("budgets.stats.total_participants_support_phase").upcase %>: - - <%= @stats[:total_participants_support_phase] %> <%= t("budgets.stats.participants") %>, - - - <%= @stats[:total_supports] %> <%= t("budgets.stats.supports") %>
-
- -   - <%= t("budgets.stats.total_participants_vote_phase").upcase %>: - - <%= @stats[:total_participants_vote_phase] %> <%= t("budgets.stats.participants") %>, - - - <%= @stats[:total_votes] %> <%= t("budgets.stats.votes") %>
-
-

-
- -
-
- -
- +
-

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

+
    + +
  • + <%= t("shared.you_are_in") %> + <%= link_to t("budgets.stats.link"), budget_stats_path(@budget), class: "is-active" %> +
  • +
+
+
+ +
+
+
+ <%= t("budgets.stats.total_participants") %> +

+ <%= @stats[:total_participants] %> +

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

+ <%= @stats[:total_budget_investments] %> +

+
-
+
+

+   + + <%= t("budgets.stats.total_feasible_investments") %>: + <%= @stats[:total_feasible_investments] %>
+
+ +   + + <%= t("budgets.stats.total_unfeasible_investments") %>: + <%= @stats[:total_unfeasible_investments] %>
+
-

-
- <%= image_tag ("budgets/stats/gender.png") %>
-
- -
-
+ +   + <%= t("budgets.stats.total_participants_support_phase") %>: + + <%= @stats[:total_participants_support_phase] %> <%= t("budgets.stats.participants") %>, + <%= @stats[:total_supports] %> <%= t("budgets.stats.supports") %>
+
+ +   + <%= t("budgets.stats.total_participants_vote_phase") %>: + + <%= @stats[:total_participants_vote_phase] %> <%= t("budgets.stats.participants") %>, + <%= @stats[:total_votes] %> <%= t("budgets.stats.votes") %>
+
+

+
+
+ +
+
+

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

-
-
-
-

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

-

- <%= @stats[:total_male_participants] %> -

-
+
+ <%= image_tag ("budgets/stats/gender.png") %> +
+ +
+
+

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

+

+ <%= @stats[:total_male_participants] %> +

-
-
-

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

-

- <%= @stats[:total_female_participants] %> -

-
+
+

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

+

+ <%= @stats[:total_female_participants] %> +

-
- -
-

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

-
- -
- - - - - - - - - - <% 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 %>) - -
- -
-
-
- -
- -
- +
-

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

-
+

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

-
- +
- - - - - + + + + + + <% all_ages_count = @stats[:age_groups].values.sum.to_f %> + <% @stats[:age_groups].each do |age_group, count| %> + "> + + + + <% end %> + +
<% 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 %><%= 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 %>) + +
+ +
+
+
+
+ +
+
+

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

+ + + + + + + + + - - - - - - - - - + + + + + + + + + <% @budget.headings.each do |heading| %> - <% ["support", "vote", "all"].each do |phase| %>
<%= t("budgets.stats.heading") %><%= t("budgets.stats.investments_sent") %><%= t("budgets.stats.participants_support_phase") %><%= t("budgets.stats.participants_voting_phase") %><%= t("budgets.stats.participants_total") %>
<%= t("budgets.stats.total").upcase %><%= t("budgets.stats.percent_total_participants_html") %><%= t("budgets.stats.percent_heading_census_html") %><%= t("budgets.stats.total").upcase %><%= t("budgets.stats.percent_total_participants_html") %><%= t("budgets.stats.percent_heading_census_html") %><%= t("budgets.stats.total").upcase %><%= t("budgets.stats.percent_total_participants_html") %><%= t("budgets.stats.percent_heading_census_html") %><%= t("budgets.stats.total") %><%= t("budgets.stats.percent_total_participants_html") %><%= t("budgets.stats.percent_heading_census_html") %><%= t("budgets.stats.total") %><%= t("budgets.stats.percent_total_participants_html") %><%= t("budgets.stats.percent_heading_census_html") %><%= t("budgets.stats.total") %><%= t("budgets.stats.percent_total_participants_html") %><%= t("budgets.stats.percent_heading_census_html") %>
+ <%= heading.name %> + class="text-center border-left border-right"> <%= heading.investments.count %> "> + class="border-left text-center"> <%= @stats[:headings][heading.id]["total_participants_#{phase}_phase".to_sym] %> "> + class="border-left border-right text-center %>"> <%= number_to_percentage(@stats[:headings][heading.id]["percentage_participants_#{phase}_phase".to_sym], strip_insignificant_zeros: true, precision: 2) %> "> + class="text-center border-right"> <%= number_to_percentage(@stats[:headings][heading.id]["percentage_district_population_#{phase}_phase".to_sym], strip_insignificant_zeros: true, precision: 2) %> @@ -256,26 +222,23 @@ <% end %>
+
+
-
-
-

- - <%= t("budgets.stats.no_demographic_data_html", total: @stats[:total_unknown_gender_or_age]) %> - -
- - <%= t("budgets.stats.participatory_disclaimer") %> - -
- - <%= t("budgets.stats.heading_disclaimer") %> - -

-
+
+
+
+

+ <%= t("budgets.stats.no_demographic_data", total: @stats[:total_unknown_gender_or_age]) %> +

+

+ <%= t("budgets.stats.participatory_disclaimer") %> +

+

+ <%= t("budgets.stats.heading_disclaimer") %> +

-
<% end %> diff --git a/config/locales/en/budgets.yml b/config/locales/en/budgets.yml index 299ae7c49..bdfa3c3cf 100644 --- a/config/locales/en/budgets.yml +++ b/config/locales/en/budgets.yml @@ -192,6 +192,7 @@ en: 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: + title: Participation stats link: Stats page_title: "%{budget} - Stats" total_participants: Total Participants @@ -203,15 +204,15 @@ en: supports: Supports votes: Votes total_participants_vote_phase: Voting Phase - by_gender_html: "Participants
by sex" + by_gender: "Participants by gender" total_male_participants: Mens total_female_participants: Women - by_age_html: "Participants by
age groups" + by_age: "Participants by age groups" age: Age total: Total more_than: More than years: years - by_heading_html: "Participants by
heading" + by_heading: "Participants by heading" heading: Heading investments_sent: Investment proposals sent participants_support_phase: Participants support phase @@ -219,6 +220,6 @@ en: participants_total: Total Participants percent_total_participants_html: "%
Total
Participants" percent_heading_census_html: "%
Heading
Census" - no_demographic_data_html: "* There is no demographic data for
%{total}
participants." + 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 5c1be0866..23f0ab491 100644 --- a/config/locales/es/budgets.yml +++ b/config/locales/es/budgets.yml @@ -192,6 +192,7 @@ es: 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: + title: Estadísticas de participación link: Estadísticas page_title: "%{budget} - Estadísticas" total_participants: Total participantes @@ -204,21 +205,21 @@ es: votes: Votos total_participants_vote_phase: Fase de votación total: Total - by_gender_html: "Participación
por sexo" + by_gender: "Participación por género" total_male_participants: Hombres total_female_participants: Mujeres - by_age_html: "Participación por
grupos de edad" + by_age: "Participación por grupos de edad" age: Edad more_than: Más de years: años - by_heading_html: "Participación por
distritos" + 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 + participants_voting_phase: Participación fase votación + participants_total: Participación total percent_total_participants_html: "%
Total
Participantes" percent_heading_census_html: "%
Censo
Distrito" - no_demographic_data_html: "* No se dispone de los datos demográficos de
%{total}
participantes." + 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."