From 51bca665330203a3d633327e4379a0cd779ae23a Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Sun, 15 Mar 2020 06:51:52 +0100 Subject: [PATCH] Adapt help component to multiple and single budget mode --- app/components/admin/budgets/help_component.rb | 10 +++++++++- .../budgets_wizard/budgets/new_component.html.erb | 1 + .../budgets_wizard/groups/index_component.html.erb | 2 +- .../headings/index_component.html.erb | 2 +- .../budgets_wizard/phases/index_component.html.erb | 2 +- app/views/admin/budget_groups/index.html.erb | 2 +- app/views/admin/budget_headings/index.html.erb | 2 +- config/i18n-tasks.yml | 4 +--- config/locales/en/admin.yml | 13 +++++++++---- config/locales/es/admin.yml | 13 +++++++++---- 10 files changed, 34 insertions(+), 17 deletions(-) diff --git a/app/components/admin/budgets/help_component.rb b/app/components/admin/budgets/help_component.rb index ecde7a43d..bd47604d4 100644 --- a/app/components/admin/budgets/help_component.rb +++ b/app/components/admin/budgets/help_component.rb @@ -5,9 +5,17 @@ class Admin::Budgets::HelpComponent < ApplicationComponent @i18n_namespace = i18n_namespace end + def budget_mode + (helpers.budget_mode if helpers.respond_to?(:budget_mode)) || "multiple" + end + private def text - t("admin.#{i18n_namespace}.index.help") + if t("admin.budgets.help.#{i18n_namespace}").is_a?(Hash) + t("admin.budgets.help.#{i18n_namespace}.#{budget_mode}") + else + t("admin.budgets.help.#{i18n_namespace}") + end end end diff --git a/app/components/admin/budgets_wizard/budgets/new_component.html.erb b/app/components/admin/budgets_wizard/budgets/new_component.html.erb index 672f3e8ca..f5c54c957 100644 --- a/app/components/admin/budgets_wizard/budgets/new_component.html.erb +++ b/app/components/admin/budgets_wizard/budgets/new_component.html.erb @@ -2,5 +2,6 @@ <%= header %> +<%= render Admin::Budgets::HelpComponent.new("budgets") %> <%= render Admin::BudgetsWizard::CreationTimelineComponent.new("budget") %> <%= render Admin::Budgets::FormComponent.new(budget, wizard: true) %> diff --git a/app/components/admin/budgets_wizard/groups/index_component.html.erb b/app/components/admin/budgets_wizard/groups/index_component.html.erb index f79361821..d9b859b3a 100644 --- a/app/components/admin/budgets_wizard/groups/index_component.html.erb +++ b/app/components/admin/budgets_wizard/groups/index_component.html.erb @@ -2,7 +2,7 @@ <%= header %> -<%= render Admin::Budgets::HelpComponent.new("budget_groups") %> +<%= render Admin::Budgets::HelpComponent.new("groups") %> <%= render Admin::BudgetsWizard::CreationTimelineComponent.new("groups") %> <% unless single_heading? %> diff --git a/app/components/admin/budgets_wizard/headings/index_component.html.erb b/app/components/admin/budgets_wizard/headings/index_component.html.erb index b2ce1fd4f..211f74d63 100644 --- a/app/components/admin/budgets_wizard/headings/index_component.html.erb +++ b/app/components/admin/budgets_wizard/headings/index_component.html.erb @@ -2,7 +2,7 @@ <%= header %> -<%= render Admin::Budgets::HelpComponent.new("budget_headings") %> +<%= render Admin::Budgets::HelpComponent.new("headings") %> <%= render Admin::BudgetsWizard::CreationTimelineComponent.new("headings") %> <% unless single_heading? %> diff --git a/app/components/admin/budgets_wizard/phases/index_component.html.erb b/app/components/admin/budgets_wizard/phases/index_component.html.erb index a613e34d0..e0cf8c9b7 100644 --- a/app/components/admin/budgets_wizard/phases/index_component.html.erb +++ b/app/components/admin/budgets_wizard/phases/index_component.html.erb @@ -2,7 +2,7 @@ <%= header %> -<%= render Admin::Budgets::HelpComponent.new("budget_phases") %> +<%= render Admin::Budgets::HelpComponent.new("phases") %> <%= render Admin::BudgetsWizard::CreationTimelineComponent.new("phases") %> <%= form_for budget, url: update_all_admin_budgets_wizard_budget_budget_phases_path(budget) do |f| %> diff --git a/app/views/admin/budget_groups/index.html.erb b/app/views/admin/budget_groups/index.html.erb index f89d3ee20..dbddbab42 100644 --- a/app/views/admin/budget_groups/index.html.erb +++ b/app/views/admin/budget_groups/index.html.erb @@ -7,5 +7,5 @@ <%= link_to t("admin.budget_groups.form.create"), new_admin_budget_group_path %> -<%= render Admin::Budgets::HelpComponent.new("budget_groups") %> +<%= render Admin::Budgets::HelpComponent.new("groups") %> <%= render Admin::BudgetGroups::GroupsComponent.new(@groups) %> diff --git a/app/views/admin/budget_headings/index.html.erb b/app/views/admin/budget_headings/index.html.erb index 48bfb4c9e..fcc2b9886 100644 --- a/app/views/admin/budget_headings/index.html.erb +++ b/app/views/admin/budget_headings/index.html.erb @@ -5,5 +5,5 @@ <%= link_to t("admin.budget_headings.form.create"), new_admin_budget_group_heading_path %> -<%= render Admin::Budgets::HelpComponent.new("budget_headings") %> +<%= render Admin::Budgets::HelpComponent.new("headings") %> <%= render Admin::BudgetHeadings::HeadingsComponent.new(@headings) %> diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 131bc8807..aa6a54f0a 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -147,9 +147,7 @@ ignore_unused: - "admin.hidden_proposal_notifications.index.filter*" - "admin.budgets.index.filter*" - "admin.budgets.edit.(administrators|valuators).*" - - "admin.budget_groups.index.*.help_block" - - "admin.budget_headings.index.*.help_block" - - "admin.budget_phases.index.help_block" + - "admin.budgets.help.*" - "admin.budget_investments.index.filter*" - "admin.budgets_wizard.heading_mode.*" - "admin.organizations.index.filter*" diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index d17e64eb3..0ca710f60 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -78,7 +78,6 @@ en: all: All open: Open finished: Finished - help: "Participatory budgets allow citizens to propose and decide directly how to spend part of the budget, with monitoring and rigorous evaluation of proposals by the institution." budget_investments: Manage projects table_completed: Completed table_draft: "Draft" @@ -135,6 +134,15 @@ en: new: title_multiple: New multiple headings budget title_single: New single heading budget + help: + budgets: "Participatory budgets allow citizens to propose and decide directly how to spend part of the budget, with monitoring and rigorous evaluation of proposals by the institution." + groups: + multiple: "Groups are meant to organize headings. After a group is created and it contais headings, it's possible to determine in how many headings a user can vote per group." + single: "Groups are meant to organize headings, since this budget will only contain one heading, the same name can be used because it will not appear anywhere. You can just continue with the next step." + headings: + multiple: "Headings are meant to divide the money of the participatory budget. Here you can add headings for this group and assign the amount of money that will be used for each heading." + single: "Headings are meant to divide the money of the participatory budget. Since this budget will only contain one heading, this is the place where you stablish the money that will be spent in this participaroty budget." + phases: "Participatory budgets have different phases. Here you can enable or disable phases and also customize each individual phase." winners: calculate: Calculate Winner Investments calculated: Winners being calculated, it may take a minute. @@ -163,7 +171,6 @@ en: submit: "Save group" index: back: "Go back to budgets" - help: "Groups are meant to organize headings. After a group is created and it contais headings, it's possible to determine in how many headings a user can vote per group." new_button: "Add new group" budget_headings: no_headings: "There are no headings." @@ -191,7 +198,6 @@ en: the_other_group: "Manage headings from the %{group} group." index: back: "Go back to groups" - help: "Headings are meant to divide the money of the participatory budget. Here you can add headings for this group and assign the amount of money that will be used for each heading." new_button: "Add new heading" title: "%{budget} / %{group} headings" budget_phases: @@ -207,7 +213,6 @@ en: name_help_text: "This is the title of the phase users will read on the header whenever this phase is active." save_changes: Save changes index: - help: "Participatory budgets have different phases. Here you can enable or disable phases and also customize each individual phase." title: "%{budget} phases" budget_investments: index: diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index f6c1ce87c..e164ad910 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -78,7 +78,6 @@ es: all: Todos open: Abiertos finished: Terminados - help: "Los presupuestos participativos permiten que los ciudadanos propongan y decidan de manera directa cómo gastar parte del presupuesto, con un seguimiento y evaluación riguroso de las propuestas por parte de la institución." budget_investments: Gestionar proyectos de gasto table_completed: Completado table_draft: "Borrador" @@ -135,6 +134,15 @@ es: new: title_multiple: Nuevo presupuesto de múltiples partidas title_single: Nuevo presupuesto de partida única + help: + budgets: "Los presupuestos participativos permiten que los ciudadanos propongan y decidan de manera directa cómo gastar parte del presupuesto, con un seguimiento y evaluación riguroso de las propuestas por parte de la institución." + groups: + multiple: "Los grupos sirven para organizar las partidas del presupuesto. Después de que un grupo sea creado y éste contenga partidas, es posible determinar el número de partidas a las que un usuario puede votar por grupo." + single: "Los grupos sirven para organizar las partidas del presupuesto, como este presupuesto sólo contendrá una partida, se puede usar el mismo nombre y éste no aparecerá en ninguna parte. Puedes continuar con el siguiente paso." + headings: + multiple: "Las partidas sirven para dividir el dinero del presupuesto participativo. Aquí puedes ir añadiendo partidas para cada grupo y establecer la cantidad de dinero que se gastará en cada partida." + single: "Las partidas sirven para dividir el dinero del presupuesto participativo. Como este presupuesto solo tendrá una partida aquí podrás establecer la cantidad de dinero que se gastará en este presupuesto participativo." + phases: "Los presupuestos participativos tienen distintas fases. Aquí puedes habilitar o deshabilitar fases y también personalizar cada una de las fases." winners: calculate: Calcular proyectos ganadores calculated: Calculando ganadores, puede tardar un minuto. @@ -163,7 +171,6 @@ es: submit: "Guardar grupo" index: back: "Volver a presupuestos" - help: "Los grupos sirven para organizar las partidas del presupuesto. Después de que un grupo sea creado y éste contenga partidas, es posible determinar el número de partidas a las que un usuario puede votar por grupo." new_button: "Añadir un grupo nuevo" budget_headings: no_headings: "No hay partidas." @@ -191,7 +198,6 @@ es: the_other_group: "Ir a partidas del grupo %{group}." index: back: "Volver a grupos" - help: "Las partidas sirven para dividir el dinero del presupuesto participativo. Aquí puedes ir añadiendo partidas para cada grupo y establecer la cantidad de dinero que se gastará en cada partida." new_button: "Añadir una partida nueva" title: "Partidas de %{budget} / %{group}" budget_phases: @@ -207,7 +213,6 @@ es: save_changes: Guardar cambios title: "Editar fase" index: - help: "Los presupuestos participativos tienen distintas fases. Aquí puedes habilitar o deshabilitar fases y también personalizar cada una de las fases." title: "Fases de %{budget}" budget_investments: index: