From 4ae6ec75e70d3d508a48d6efc1ac992af5a71657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Tue, 9 May 2017 11:27:07 +0200 Subject: [PATCH] adds links in ballot view to no voted groups --- app/views/budgets/ballot/_ballot.html.erb | 23 ++++++++++++++++++++--- config/locales/budgets.en.yml | 1 + config/locales/budgets.es.yml | 1 + spec/features/budgets/ballots_spec.rb | 12 ++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/app/views/budgets/ballot/_ballot.html.erb b/app/views/budgets/ballot/_ballot.html.erb index 72a0d1c6e..bfaa98768 100644 --- a/app/views/budgets/ballot/_ballot.html.erb +++ b/app/views/budgets/ballot/_ballot.html.erb @@ -19,9 +19,9 @@
- <% @ballot.groups.order(name: :asc).each do |group| %> -
+ <% ballot_groups = @ballot.groups.order(name: :asc) %> + <% ballot_groups.each do |group| %> +

@@ -52,4 +52,21 @@

<% end %> + + <% no_balloted_groups = @budget.groups.order(name: :asc) - ballot_groups %> + <% no_balloted_groups.each do |group| %> +
+
+
+

+ <%= group.name %> +

+ + <%= link_to t("budgets.ballots.show.no_balloted_group_yet"), budget_group_path(@budget, group) %> + +
+
+
+ <% end %> +
diff --git a/config/locales/budgets.en.yml b/config/locales/budgets.en.yml index 49d1558cf..191a41f14 100644 --- a/config/locales/budgets.en.yml +++ b/config/locales/budgets.en.yml @@ -5,6 +5,7 @@ en: title: Your ballot amount_spent: Amount spent remaining: "You still have %{amount} to invest." + no_balloted_group_yet: "You have not voted on this group yet, go vote!" remove: Remove vote voted_html: one: "You have voted one proposal." diff --git a/config/locales/budgets.es.yml b/config/locales/budgets.es.yml index 98ef4ad4e..b036d1aa4 100644 --- a/config/locales/budgets.es.yml +++ b/config/locales/budgets.es.yml @@ -5,6 +5,7 @@ es: title: Mis votos amount_spent: Coste total remaining: "Te quedan %{amount} para invertir" + no_balloted_group_yet: "Todavía no has votado proyectos de este grupo, ¡vota!" remove: Quitar voto voted_html: one: "Has votado una propuesta." diff --git a/spec/features/budgets/ballots_spec.rb b/spec/features/budgets/ballots_spec.rb index 227241ee7..b789fcb86 100644 --- a/spec/features/budgets/ballots_spec.rb +++ b/spec/features/budgets/ballots_spec.rb @@ -350,6 +350,18 @@ feature 'Ballots' do end end + scenario 'Display links to vote on groups with no investments voted yet' do + group = create(:budget_group, budget: budget) + heading = create(:budget_heading, name: "District 1", group: group, price: 100) + + ballot = create(:budget_ballot, user: user, budget: budget) + + login_as(user) + visit budget_ballot_path(budget) + + expect(page).to have_link "You have not voted on this group yet, go vote!", href: budget_group_path(budget, group) + end + end scenario 'Removing investments from ballot', :js do