From 7eda4be2193d4e24c58f2d353098901583616709 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 16 Mar 2020 12:54:00 +0100 Subject: [PATCH] Add link to preview budget on budgets table --- app/components/admin/budgets/drafting_component.html.erb | 2 +- app/components/admin/budgets/table_actions_component.html.erb | 4 ++++ config/locales/en/admin.yml | 3 ++- config/locales/es/admin.yml | 3 ++- spec/components/admin/budgets/table_actions_component_spec.rb | 3 ++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/components/admin/budgets/drafting_component.html.erb b/app/components/admin/budgets/drafting_component.html.erb index 5b7e1b898..6c84a4972 100644 --- a/app/components/admin/budgets/drafting_component.html.erb +++ b/app/components/admin/budgets/drafting_component.html.erb @@ -5,7 +5,7 @@ <% end %> - <%= link_to t("admin.budgets.edit.preview"), budget_path(budget), class: "preview-link", target: "_blank" %> + <%= link_to t("admin.budgets.actions.preview"), budget_path(budget), class: "preview-link", target: "_blank" %> <% if can? :publish, budget %> <%= link_to t("admin.budgets.edit.publish"), diff --git a/app/components/admin/budgets/table_actions_component.html.erb b/app/components/admin/budgets/table_actions_component.html.erb index 8bc788c34..e2d86ae80 100644 --- a/app/components/admin/budgets/table_actions_component.html.erb +++ b/app/components/admin/budgets/table_actions_component.html.erb @@ -12,4 +12,8 @@ <% else %> <%= link_to_create_budget_poll %> <% end %> + <%= link_to t("admin.budgets.actions.preview"), + budget_path(budget), + target: "_blank", + class: "preview-link" %> <% end %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index ea77fd309..ddaafb641 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -63,6 +63,8 @@ en: type: Type no_activity: There are no moderators activity. budgets: + actions: + preview: "Preview budget" index: title: Participatory budgets new_link: Create new budget @@ -87,7 +89,6 @@ en: edit: title: Edit Participatory budget drafting: "This participatory budget is in draft mode, only administrators can see it in the public site. Once it's published it cannot be changed to draft mode again." - preview: "Preview budget" publish: "Publish budget" delete: Delete budget phase: Phase diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 890881f94..8afb17164 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -63,6 +63,8 @@ es: type: Tipo no_activity: No hay actividad de moderadores. budgets: + actions: + preview: "Previsualizar presupuesto" index: title: Presupuestos participativos new_link: Crear nuevo presupuesto @@ -87,7 +89,6 @@ es: edit: title: Editar presupuestos participativos drafting: "Este presupuesto participativo está en modo borrador, solo los administradores pueden verlo desde la parte pública de la página. Una vez se haya publicado, no se podrá volver a poner en modo borrador otra vez." - preview: "Previsualizar presupuesto" publish: "Publicar presupuesto" delete: Eliminar presupuesto phase: Fase diff --git a/spec/components/admin/budgets/table_actions_component_spec.rb b/spec/components/admin/budgets/table_actions_component_spec.rb index 36aeea537..97f20083f 100644 --- a/spec/components/admin/budgets/table_actions_component_spec.rb +++ b/spec/components/admin/budgets/table_actions_component_spec.rb @@ -11,11 +11,12 @@ describe Admin::Budgets::TableActionsComponent, type: :component do it "renders links to edit budget, manage investments and edit groups and manage ballots" do render_inline component - expect(page).to have_css "a", count: 4 + expect(page).to have_css "a", count: 5 expect(page).to have_link "Manage projects", href: /investments/ expect(page).to have_link "Edit headings groups", href: /groups/ expect(page).to have_link "Edit budget", href: /edit/ expect(page).to have_link "Admin ballots" + expect(page).to have_link "Preview budget", href: /budgets/ end it "renders link to create new poll for budgets without polls" do