From dba8b6a7c9150f8a827559586a8f2cece3e1e299 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 20 Mar 2018 19:19:13 +0100 Subject: [PATCH 1/9] Improves i18n of admin budgets --- config/locales/es/admin.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 6718f6891..37b103923 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -80,11 +80,11 @@ es: edit_groups: Editar grupos de partidas edit_budget: Editar presupuesto create: - notice: '¡Nueva campaña de presupuestos participativos creada con éxito!' + notice: "¡Presupuestos participativos creados con éxito!" update: - notice: Campaña de presupuestos participativos actualizada + notice: Presupuestos participativos actualizados edit: - title: Editar campaña de presupuestos participativos + title: Editar presupuestos participativos delete: Eliminar presupuesto phase: Fase dates: Fechas From 1f825993803f082e8ed821efe3b62276ec16d811 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 20 Mar 2018 19:25:47 +0100 Subject: [PATCH 2/9] Adds class on back link to admin budget investments show --- app/views/admin/budget_investments/show.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/admin/budget_investments/show.html.erb b/app/views/admin/budget_investments/show.html.erb index d7f905080..f9e7dc88e 100644 --- a/app/views/admin/budget_investments/show.html.erb +++ b/app/views/admin/budget_investments/show.html.erb @@ -1,5 +1,6 @@ -<%= link_to admin_budget_budget_investments_path(Budget::Investment.filter_params(params)), data: {no_turbolink: true} do %> - <%= t("shared.back") %> +<%= link_to admin_budget_budget_investments_path(Budget::Investment.filter_params(params)), + class: "back", data: {no_turbolink: true} do %> + <%= t("shared.back") %> <% end %> <%= render 'written_by_author' %> From 9a60f5370d1002cd6624681b3879b842bd74346f Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 20 Mar 2018 19:28:28 +0100 Subject: [PATCH 3/9] Moves h3 tag outside of table on polls results --- app/views/polls/results.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/polls/results.html.erb b/app/views/polls/results.html.erb index 4373da22d..cafb1c9a9 100644 --- a/app/views/polls/results.html.erb +++ b/app/views/polls/results.html.erb @@ -17,8 +17,8 @@
<%- @poll.questions.each do |question| %> +

<%= question.title %>

-

<%= question.title %>

<%- question.question_answers.each do |answer| %> From 725c282ba5637ce31e62a57178dd913047a38f0a Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 20 Mar 2018 19:43:12 +0100 Subject: [PATCH 4/9] Adds unicode_normalize for alt and title on images --- app/views/budgets/investments/_investment.html.erb | 3 ++- app/views/budgets/investments/_milestones.html.erb | 11 ++++++++--- app/views/images/_image.html.erb | 6 +++--- app/views/polls/_gallery.html.erb | 6 +++--- app/views/polls/_poll_group.html.erb | 2 +- app/views/proposals/_proposal.html.erb | 3 ++- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app/views/budgets/investments/_investment.html.erb b/app/views/budgets/investments/_investment.html.erb index 87b3dcc6b..964c8ed56 100644 --- a/app/views/budgets/investments/_investment.html.erb +++ b/app/views/budgets/investments/_investment.html.erb @@ -6,7 +6,8 @@
- <%= image_tag investment.image_url(:thumb), alt: investment.image.title %> + <%= image_tag investment.image_url(:thumb), + alt: investment.image.title.unicode_normalize %>
diff --git a/app/views/budgets/investments/_milestones.html.erb b/app/views/budgets/investments/_milestones.html.erb index eb151a9ab..5fc984808 100644 --- a/app/views/budgets/investments/_milestones.html.erb +++ b/app/views/budgets/investments/_milestones.html.erb @@ -13,11 +13,16 @@
<% if milestone.publication_date.present? %> - <%= t("budgets.investments.show.milestone_publication_date", - publication_date: l(milestone.publication_date.to_date)) %> + + <%= t("budgets.investments.show.milestone_publication_date", + publication_date: l(milestone.publication_date.to_date)) %> + <% end %> - <%= image_tag(milestone.image_url(:large), { alt: milestone.image.title, class: "margin", id: "image_#{milestone.id}" }) if milestone.image.present? %> + <%= image_tag(milestone.image_url(:large), + { alt: milestone.image.title.unicode_normalize, + class: "margin", + id: "image_#{milestone.id}" }) if milestone.image.present? %>

<%= text_with_links milestone.description %>

<% if milestone.documents.present? %> <% end %> diff --git a/app/views/map_locations/_form_fields.html.erb b/app/views/map_locations/_form_fields.html.erb index 41423b50d..be95b0888 100644 --- a/app/views/map_locations/_form_fields.html.erb +++ b/app/views/map_locations/_form_fields.html.erb @@ -19,12 +19,12 @@
<%= form.label :skip_map do %> - <%= form.check_box :skip_map, - title: t("proposals.form.map_skip_checkbox"), + <%= form.check_box :skip_map, + title: t("proposals.form.map_skip_checkbox"), label: false, class: 'js-toggle-map' %> - <%= t("proposals.form.map_skip_checkbox") %> + <%= t("#{i18n_namespace}.form.map_skip_checkbox") %> <% end %>
diff --git a/app/views/proposals/_form.html.erb b/app/views/proposals/_form.html.erb index f60397b17..ae6e329bc 100644 --- a/app/views/proposals/_form.html.erb +++ b/app/views/proposals/_form.html.erb @@ -72,7 +72,8 @@ label: t("proposals.form.map_location"), help: t("proposals.form.map_location_instructions"), remove_marker_label: t("proposals.form.map_remove_marker"), - parent_class: "proposal" %> + parent_class: "proposal", + i18n_namespace: "proposals" %>
<% end %> diff --git a/config/locales/en/budgets.yml b/config/locales/en/budgets.yml index b50e122a8..f55bafeed 100644 --- a/config/locales/en/budgets.yml +++ b/config/locales/en/budgets.yml @@ -71,6 +71,7 @@ en: map_location_instructions: "Navigate the map to the location and place the marker." map_remove_marker: "Remove map marker" location: "Location additional info" + map_skip_checkbox: "This investment doesn't have a concrete location or I'm not aware of it." index: title: Participatory budgeting unfeasible: Unfeasible investment projects diff --git a/config/locales/es/budgets.yml b/config/locales/es/budgets.yml index 2bf7cf85a..d02f2380e 100644 --- a/config/locales/es/budgets.yml +++ b/config/locales/es/budgets.yml @@ -71,6 +71,7 @@ es: map_location_instructions: "Navega por el mapa hasta la ubicación y coloca el marcador." map_remove_marker: "Eliminar el marcador" location: "Información adicional de la ubicación" + map_skip_checkbox: "Este proyecto no tiene una ubicación concreta o no la conozco." index: title: Presupuestos participativos unfeasible: Proyectos de gasto no viables From 3f7395fa19d12c77e4650f12a0522eaf238e4956 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 3 Apr 2018 19:17:17 +0200 Subject: [PATCH 6/9] Adds message on polls index if there are no open polls --- app/views/polls/index.html.erb | 36 ++++++++++++++++++------------- config/locales/en/general.yml | 1 + config/locales/es/general.yml | 1 + spec/features/polls/polls_spec.rb | 3 +++ 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/app/views/polls/index.html.erb b/app/views/polls/index.html.erb index 6877cd31d..7f905491f 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -9,24 +9,30 @@
<%= render 'shared/filter_subnav', i18n_namespace: "polls.index" %> - <% polls_by_geozone_restriction = @polls.group_by(&:geozone_restricted) %> + <% if @polls.any? %> + <% polls_by_geozone_restriction = @polls.group_by(&:geozone_restricted) %> - <% if polls_by_geozone_restriction[false].present? %> -

- <%= t("polls.index.no_geozone_restricted") %> -

- <%= render partial: 'poll_group', locals: {poll_group: polls_by_geozone_restriction[false]} %> + <% if polls_by_geozone_restriction[false].present? %> +

+ <%= t("polls.index.no_geozone_restricted") %> +

+ <%= render partial: 'poll_group', locals: {poll_group: polls_by_geozone_restriction[false]} %> + <% end %> + + <% if polls_by_geozone_restriction[true].present? %> +

+ <%= t("polls.index.geozone_restricted") %> +

+ <%= render partial: 'poll_group', locals: {poll_group: polls_by_geozone_restriction[true]} %> + <% end %> + + <%= paginate @polls %> + <% else %> +
+ <%= t("polls.index.no_polls") %> +
<% end %> - <% if polls_by_geozone_restriction[true].present? %> -

- <%= t("polls.index.geozone_restricted") %> -

- <%= render partial: 'poll_group', locals: {poll_group: polls_by_geozone_restriction[true]} %> - <% end %> - - <%= paginate @polls %> -

<%= t("polls.index.section_footer.title") %> diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index 1a22db1b1..aa2c0de16 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -487,6 +487,7 @@ en: description: Sign up to vote on citizen proposals and questions the City Council ask to the neighbors. Make municipal decisions directly. help_text_1: "Voting takes place when a citizen proposal supports reaches 1% of the census with voting rights. Voting can also include questions that the City Council ask to the citizens decision." help_text_2: "To participate in the next vote you have to sign up on %{org} and verify your account. All registered voters in the city over 16 years old can vote. The results of all votes are binding on the government." + no_polls: "There are no open votings." show: already_voted_in_booth: "You have already participated in a physical booth. You can not participate again." already_voted_in_web: "You have already participated in this poll. If you vote again it will be overwritten." diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 70a18a2ac..458156352 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -487,6 +487,7 @@ es: description: Regístrate para poder votar propuestas ciudadanas y las cuestiones que pregunta a sus vecinos el Ayuntamiento. Toma decisiones municipales de forma directa. help_text_1: "Las votaciones se convocan cuando una propuesta ciudadana alcanza el 1% de apoyos del censo con derecho a voto. En las votaciones también se pueden incluir cuestiones que el Ayuntamiento somete a decisión directa de la ciudadanía." help_text_2: "Para participar en la próxima votación tienes que registrarte en %{org} y verificar tu cuenta. Pueden votar todas las personas empadronadas en la ciudad mayores de 16 años. Los resultados de todas las votaciones serán vinculantes para el gobierno." + no_polls: "No hay votaciones abiertas." show: already_voted_in_booth: "Ya has participado en esta votación en urnas presenciales, no puedes volver a participar." already_voted_in_web: "Ya has participado en esta votación. Si vuelves a votar se sobreescribirá tu resultado anterior." diff --git a/spec/features/polls/polls_spec.rb b/spec/features/polls/polls_spec.rb index c2e8413cf..be6e6ff4e 100644 --- a/spec/features/polls/polls_spec.rb +++ b/spec/features/polls/polls_spec.rb @@ -9,6 +9,9 @@ feature 'Polls' do context '#index' do scenario 'Polls can be listed' do + visit polls_path + expect(page).to have_content('There are no open votings') + polls = create_list(:poll, 3) create(:image, imageable: polls[0]) create(:image, imageable: polls[1]) From 56f64779ba41ed180f73742164cbc83d9935efd5 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 20 Mar 2018 20:12:44 +0100 Subject: [PATCH 7/9] Fixes actions buttons on admin valuators index table --- app/views/admin/valuators/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/valuators/index.html.erb b/app/views/admin/valuators/index.html.erb index 902067588..03d3fb885 100644 --- a/app/views/admin/valuators/index.html.erb +++ b/app/views/admin/valuators/index.html.erb @@ -14,7 +14,7 @@

- + <% @valuators.each do |valuator| %> From b93543cbf94732c5c0cb41368110e197d9f06db0 Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 22 Mar 2018 12:15:59 +0100 Subject: [PATCH 8/9] Shows message only if there is questions on legislation debate --- .../legislation/processes/_debate.html.erb | 12 ++++++----- .../legislation/processes/debate.html.erb | 12 ++++++----- spec/features/legislation/processes_spec.rb | 21 ++++++++++++++++--- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/app/views/legislation/processes/_debate.html.erb b/app/views/legislation/processes/_debate.html.erb index 039ee1f6f..fe4c02cef 100644 --- a/app/views/legislation/processes/_debate.html.erb +++ b/app/views/legislation/processes/_debate.html.erb @@ -1,15 +1,17 @@
<% if process.questions.empty? %> -

<%= t('.empty_questions') %>

+

<%= t("legislation.processes.debate.empty_questions") %>

<% else %> <%= render process.questions %> <% end %>
-
-
-

<%= t('.participate') %>

+<% if process.questions.any? %> +
+
+

<%= t("legislation.processes.debate.participate") %>

+
-
+<% end %> \ No newline at end of file diff --git a/app/views/legislation/processes/debate.html.erb b/app/views/legislation/processes/debate.html.erb index a6042bd84..52969cef2 100644 --- a/app/views/legislation/processes/debate.html.erb +++ b/app/views/legislation/processes/debate.html.erb @@ -13,7 +13,7 @@
<% if @process.questions.empty? %>
-

<%= t('.empty_questions') %>

+

<%= t("legislation.processes.debate.empty_questions") %>

<% else %> <%= render @process.questions %> @@ -21,11 +21,13 @@
-
-
-

<%= t('.participate') %>

+ <% if @process.questions.any? %> +
+
+

<%= t("legislation.processes.debate.participate") %>

+
-
+ <% end %>
diff --git a/spec/features/legislation/processes_spec.rb b/spec/features/legislation/processes_spec.rb index 73d1f46d9..0f233a577 100644 --- a/spec/features/legislation/processes_spec.rb +++ b/spec/features/legislation/processes_spec.rb @@ -149,15 +149,30 @@ feature 'Legislation' do visit legislation_process_path(process) - expect(page).to have_content("This phase is not open yet") + expect(page).to have_content("This phase is not open yet") + expect(page).to_not have_content("Participate in the debate") end - scenario 'open' do + scenario 'open without questions' do process = create(:legislation_process, debate_start_date: Date.current - 1.day, debate_end_date: Date.current + 2.days) visit legislation_process_path(process) - expect(page).to have_content("Participate in the debate") + expect(page).to_not have_content("Participate in the debate") + expect(page).to_not have_content("This phase is not open yet") + end + + scenario 'open with questions' do + process = create(:legislation_process, debate_start_date: Date.current - 1.day, debate_end_date: Date.current + 2.days) + create(:legislation_question, process: process, title: "Question 1") + create(:legislation_question, process: process, title: "Question 2") + + visit legislation_process_path(process) + + expect(page).to have_content("Question 1") + expect(page).to have_content("Question 2") + expect(page).to have_content("Participate in the debate") + expect(page).to_not have_content("This phase is not open yet") end include_examples "not published permissions", :debate_legislation_process_path From 02cef6dec5f759dc998482b65983b22ae84f78fc Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 22 Mar 2018 16:07:04 +0100 Subject: [PATCH 9/9] Fixes missing i18n --- app/views/map_locations/_form_fields.html.erb | 2 +- config/i18n-tasks.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/map_locations/_form_fields.html.erb b/app/views/map_locations/_form_fields.html.erb index be95b0888..f09662649 100644 --- a/app/views/map_locations/_form_fields.html.erb +++ b/app/views/map_locations/_form_fields.html.erb @@ -20,7 +20,7 @@
<%= form.label :skip_map do %> <%= form.check_box :skip_map, - title: t("proposals.form.map_skip_checkbox"), + title: t("#{i18n_namespace}.form.map_skip_checkbox"), label: false, class: 'js-toggle-map' %> diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 41bf3e604..04adffb48 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -176,6 +176,7 @@ ignore_unused: - 'admin.legislation.processes.process.*' - 'legislation.processes.index.*' - 'votes.budget_investments.different_heading_assigned*' + - '*.form.map_skip_checkbox' # - '{devise,kaminari,will_paginate}.*' # - 'simple_form.{yes,no}' # - 'simple_form.{placeholders,hints,labels}.*'
<%= t("admin.valuators.index.email") %> <%= t("admin.valuators.index.description") %> <%= t("admin.valuators.index.group") %><%= t("admin.actions.actions") %><%= t("admin.actions.actions") %>