From 29cad341f583b5db6c843377d321f6f8aa89de3d Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 5 Sep 2016 14:47:11 +0200 Subject: [PATCH] Adds voting in selecting phase --- .../budgets/investments/_investment.html.erb | 9 +- app/views/budgets/investments/_votes.html.erb | 2 +- app/views/budgets/investments/show.html.erb | 10 +- app/views/budgets/investments/vote.js.erb | 1 + spec/features/votes_spec.rb | 130 ++++++++++++++++-- spec/support/common_actions.rb | 5 + 6 files changed, 137 insertions(+), 20 deletions(-) create mode 100644 app/views/budgets/investments/vote.js.erb diff --git a/app/views/budgets/investments/_investment.html.erb b/app/views/budgets/investments/_investment.html.erb index 84f105c18..fd51ac532 100644 --- a/app/views/budgets/investments/_investment.html.erb +++ b/app/views/budgets/investments/_investment.html.erb @@ -43,18 +43,23 @@ <% unless investment.unfeasible? %> - <% if feature?("investment_features.phase2") %> + + <% if @budget.selecting? || @budget.on_hold? %> +
<%= render 'votes', - { investment: investment, vote_url: vote_investment_path(investment, value: 'yes') } %> + { investment: investment, + vote_url: vote_budget_investment_path(@budget, investment, value: 'yes') } %>
+ <% elsif feature?("investment_features.phase3") %>
<%= render 'ballot', investment: investment %>
<% end %> + <% end %> diff --git a/app/views/budgets/investments/_votes.html.erb b/app/views/budgets/investments/_votes.html.erb index 62ea74283..d243535d1 100644 --- a/app/views/budgets/investments/_votes.html.erb +++ b/app/views/budgets/investments/_votes.html.erb @@ -13,7 +13,7 @@
<%= t("budget.investments.investment.already_supported") %>
- <% elsif voting_allowed %> + <% elsif @budget.selecting? %> <%= link_to vote_url, class: "button button-support small expanded", diff --git a/app/views/budgets/investments/show.html.erb b/app/views/budgets/investments/show.html.erb index 5a751e615..2488262f8 100644 --- a/app/views/budgets/investments/show.html.erb +++ b/app/views/budgets/investments/show.html.erb @@ -45,15 +45,19 @@ <% if (@budget.selecting? && !@investment.unfeasible?) || - (@budget.balloting? && @investment.feasible?) %> + (@budget.balloting? && @investment.feasible? || + (@budget.on_hold?)) %>