From 5413c3445836b84f9be1827a1b0fda01f4a37720 Mon Sep 17 00:00:00 2001 From: Marko Lovic Date: Wed, 25 Jul 2018 14:56:32 +0200 Subject: [PATCH 1/3] Restructure and rename translations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on 012e4be by María Checa from AyuntamientoMadrid/consul fork --- app/models/budget/investment/exporter.rb | 20 +++++++-------- .../budget_investments/_investments.html.erb | 24 +++++++++--------- config/locales/en/admin.yml | 25 ++++++++++--------- config/locales/es/admin.yml | 25 ++++++++++--------- 4 files changed, 48 insertions(+), 46 deletions(-) diff --git a/app/models/budget/investment/exporter.rb b/app/models/budget/investment/exporter.rb index 03900fd7e..4d0102e0d 100644 --- a/app/models/budget/investment/exporter.rb +++ b/app/models/budget/investment/exporter.rb @@ -16,16 +16,16 @@ class Budget::Investment::Exporter def headers [ - I18n.t("admin.budget_investments.index.table_id"), - I18n.t("admin.budget_investments.index.table_title"), - I18n.t("admin.budget_investments.index.table_supports"), - I18n.t("admin.budget_investments.index.table_admin"), - I18n.t("admin.budget_investments.index.table_valuator"), - I18n.t("admin.budget_investments.index.table_valuation_group"), - I18n.t("admin.budget_investments.index.table_geozone"), - I18n.t("admin.budget_investments.index.table_feasibility"), - I18n.t("admin.budget_investments.index.table_valuation_finished"), - I18n.t("admin.budget_investments.index.table_selection") + I18n.t("admin.budget_investments.index.list.id"), + I18n.t("admin.budget_investments.index.list.title"), + I18n.t("admin.budget_investments.index.list.supports"), + I18n.t("admin.budget_investments.index.list.admin"), + I18n.t("admin.budget_investments.index.list.valuator"), + I18n.t("admin.budget_investments.index.list.valuation_group"), + I18n.t("admin.budget_investments.index.list.geozone"), + I18n.t("admin.budget_investments.index.list.feasibility"), + I18n.t("admin.budget_investments.index.list.valuation_finished"), + I18n.t("admin.budget_investments.index.list.selected") ] end diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb index 17b0315b1..b51c20c3b 100644 --- a/app/views/admin/budget_investments/_investments.html.erb +++ b/app/views/admin/budget_investments/_investments.html.erb @@ -35,21 +35,21 @@ - - - - + + + + - - - - - + + + + + <% if params[:filter] == "selected" %> - + <% end %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index ac23897df..7cca0df20 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -187,18 +187,19 @@ en: undecided: "Undecided" selected: "Selected" select: "Select" - table_id: "ID" - table_title: "Title" - table_supports: "Supports" - table_admin: "Administrator" - table_valuator: "Valuator" - table_valuation_group: "Valuation Group" - table_geozone: "Scope of operation" - table_feasibility: "Feasibility" - table_valuation_finished: "Val. Fin." - table_selection: "Selected" - table_evaluation: "Show to valuators" - table_incompatible: "Incompatible" + list: + id: ID + title: Title + supports: Supports + admin: Administrator + valuator: Valuator + valuation_group: Valuation Group + geozone: Scope of operation + feasibility: Feasibility + valuation_finished: Val. Fin. + selected: Selected + visible_to_valuators: Show to valuators + incompatible: Incompatible cannot_calculate_winners: The budget has to stay on phase "Balloting projects", "Reviewing Ballots" or "Finished budget" in order to calculate winners projects see_results: "See results" show: diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 8929f9e3b..dec9a5dfd 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -187,18 +187,19 @@ es: undecided: "Sin decidir" selected: "Seleccionada" select: "Seleccionar" - table_id: "ID" - table_title: "Título" - table_supports: "Apoyos" - table_admin: "Administrador" - table_valuator: "Evaluador" - table_valuation_group: "Grupos evaluadores" - table_geozone: "Ámbito de actuación" - table_feasibility: "Viabilidad" - table_valuation_finished: "Ev. Fin." - table_selection: "Seleccionado" - table_evaluation: "Mostrar a evaluadores" - table_incompatible: "Incompatible" + list: + id: ID + title: Título + supports: Apoyos + admin: Administrador + valuator: Evaluador + valuation_group: Grupos evaluadores + geozone: Ámbito de actuación + feasibility: Viabilidad + valuation_finished: Ev. Fin. + selected: Seleccionado + visible_to_valuators: Mostrar a evaluadores + incompatible: Incompatible cannot_calculate_winners: El presupuesto debe estar en las fases "Votación final", "Votación finalizada" o "Resultados" para poder calcular las propuestas ganadoras see_results: "Ver resultados" show: From 601e3058d865e7bda54d7ce1dddf5f7c37d88ebe Mon Sep 17 00:00:00 2001 From: Marko Lovic Date: Wed, 25 Jul 2018 15:10:56 +0200 Subject: [PATCH 2/3] Add `visible_to_valuators` and author username to admin investments CSV MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport based on 012e4be by María Checa from AyuntamientoMadrid/consul fork --- app/models/budget/investment/exporter.rb | 8 ++++++-- config/locales/en/admin.yml | 1 + config/locales/es/admin.yml | 1 + spec/features/admin/budget_investments_spec.rb | 15 +++++++++------ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/models/budget/investment/exporter.rb b/app/models/budget/investment/exporter.rb index 4d0102e0d..c7e4ce461 100644 --- a/app/models/budget/investment/exporter.rb +++ b/app/models/budget/investment/exporter.rb @@ -25,7 +25,9 @@ class Budget::Investment::Exporter I18n.t("admin.budget_investments.index.list.geozone"), I18n.t("admin.budget_investments.index.list.feasibility"), I18n.t("admin.budget_investments.index.list.valuation_finished"), - I18n.t("admin.budget_investments.index.list.selected") + I18n.t("admin.budget_investments.index.list.selected"), + I18n.t("admin.budget_investments.index.list.visible_to_valuators"), + I18n.t("admin.budget_investments.index.list.author_username") ] end @@ -40,7 +42,9 @@ class Budget::Investment::Exporter investment.heading.name, price(investment), investment.valuation_finished? ? I18n.t('shared.yes') : I18n.t('shared.no'), - investment.selected? ? I18n.t('shared.yes') : I18n.t('shared.no') + investment.selected? ? I18n.t('shared.yes') : I18n.t('shared.no'), + investment.visible_to_valuators? ? I18n.t('shared.yes') : I18n.t('shared.no'), + investment.author.username ] end diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 7cca0df20..ca619c7d4 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -199,6 +199,7 @@ en: valuation_finished: Val. Fin. selected: Selected visible_to_valuators: Show to valuators + author_username: Author username incompatible: Incompatible cannot_calculate_winners: The budget has to stay on phase "Balloting projects", "Reviewing Ballots" or "Finished budget" in order to calculate winners projects see_results: "See results" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index dec9a5dfd..909e2509a 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -199,6 +199,7 @@ es: valuation_finished: Ev. Fin. selected: Seleccionado visible_to_valuators: Mostrar a evaluadores + author_username: Usuario autor incompatible: Incompatible cannot_calculate_winners: El presupuesto debe estar en las fases "Votación final", "Votación finalizada" o "Resultados" para poder calcular las propuestas ganadoras see_results: "Ver resultados" diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index a745be1c1..3fd4d4175 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -1060,13 +1060,15 @@ feature 'Admin budget investments' do cached_votes_up: 88, price: 99, valuators: [], valuator_groups: [valuator_group], - administrator: admin) + administrator: admin, + visible_to_valuators: true) second_investment = create(:budget_investment, :unfeasible, title: "Alt Investment", budget: budget, group: budget_group, heading: second_budget_heading, cached_votes_up: 66, price: 88, valuators: [valuator], - valuator_groups: []) + valuator_groups: [], + visible_to_valuators: false) visit admin_budget_budget_investments_path(budget) @@ -1077,10 +1079,11 @@ feature 'Admin budget investments' do expect(header).to match(/filename="budget_investments.csv"$/) csv_contents = "ID,Title,Supports,Administrator,Valuator,Valuation Group,Scope of operation,"\ - "Feasibility,Val. Fin.,Selected\n#{first_investment.id},Le Investment,88,"\ - "Admin,-,Valuator Group,Budget Heading,Feasible (€99),Yes,Yes\n"\ - "#{second_investment.id},Alt Investment,66,No admin assigned,Valuator,-,"\ - "Other Heading,Unfeasible,No,No\n" + "Feasibility,Val. Fin.,Selected,Show to valuators,Author username\n"\ + "#{first_investment.id},Le Investment,88,Admin,-,Valuator Group,"\ + "Budget Heading,Feasible (€99),Yes,Yes,Yes,#{first_investment.author.username}\n#{second_investment.id},"\ + "Alt Investment,66,No admin assigned,Valuator,-,Other Heading,"\ + "Unfeasible,No,No,No,#{second_investment.author.username}\n" expect(page.body).to eq(csv_contents) end From c991d9e7c73f4e713502df0ff8a41e3ae759667d Mon Sep 17 00:00:00 2001 From: Marko Lovic Date: Wed, 25 Jul 2018 17:28:14 +0200 Subject: [PATCH 3/3] Fix typo in i18n key --- app/views/admin/budget_investments/_investments.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb index b51c20c3b..c5b7493c6 100644 --- a/app/views/admin/budget_investments/_investments.html.erb +++ b/app/views/admin/budget_investments/_investments.html.erb @@ -35,7 +35,7 @@
<%= t("admin.budget_investments.index.table_id") %><%= t("admin.budget_investments.index.table_title") %><%= t("admin.budget_investments.index.table_supports") %><%= t("admin.budget_investments.index.table_admin") %><%= t("admin.budget_investments.index.index.list.id") %><%= t("admin.budget_investments.index.list.title") %><%= t("admin.budget_investments.index.list.supports") %><%= t("admin.budget_investments.index.list.admin") %> - <%= t("admin.budget_investments.index.table_valuation_group") %> - <%= t("admin.budget_investments.index.table_valuator") %> + <%= t("admin.budget_investments.index.list.valuation_group") %> + <%= t("admin.budget_investments.index.list.valuator") %> <%= t("admin.budget_investments.index.table_geozone") %><%= t("admin.budget_investments.index.table_feasibility") %><%= t("admin.budget_investments.index.table_valuation_finished") %><%= t("admin.budget_investments.index.table_evaluation") %><%= t("admin.budget_investments.index.table_selection") %><%= t("admin.budget_investments.index.list.geozone") %><%= t("admin.budget_investments.index.list.feasibility") %><%= t("admin.budget_investments.index.list.valuation_finished") %><%= t("admin.budget_investments.index.list.visible_to_valuators") %><%= t("admin.budget_investments.index.list.selected") %><%= t("admin.budget_investments.index.table_incompatible") %><%= t("admin.budget_investments.index.list.incompatible") %>
- +
<%= t("admin.budget_investments.index.index.list.id") %><%= t("admin.budget_investments.index.list.id") %> <%= t("admin.budget_investments.index.list.title") %> <%= t("admin.budget_investments.index.list.supports") %> <%= t("admin.budget_investments.index.list.admin") %>