adds links in ballot view to no voted groups

This commit is contained in:
Juanjo Bazán
2017-05-09 11:27:07 +02:00
parent c14a604618
commit 4ae6ec75e7
4 changed files with 34 additions and 3 deletions

View File

@@ -19,9 +19,9 @@
</div> </div>
<div class="row ballot"> <div class="row ballot">
<% @ballot.groups.order(name: :asc).each do |group| %> <% ballot_groups = @ballot.groups.order(name: :asc) %>
<div id="<%= dom_id(group) %>" <% ballot_groups.each do |group| %>
class="small-12 medium-6 column end"> <div id="<%= dom_id(group) %>" class="small-12 medium-6 column end">
<div class="margin-top ballot-content"> <div class="margin-top ballot-content">
<div class="subtitle"> <div class="subtitle">
<h3> <h3>
@@ -52,4 +52,21 @@
</div> </div>
</div> </div>
<% end %> <% end %>
<% no_balloted_groups = @budget.groups.order(name: :asc) - ballot_groups %>
<% no_balloted_groups.each do |group| %>
<div id="<%= dom_id(group) %>" class="small-12 medium-6 column end">
<div class="margin-top ballot-content">
<div class="subtitle">
<h3>
<%= group.name %>
</h3>
<strong>
<%= link_to t("budgets.ballots.show.no_balloted_group_yet"), budget_group_path(@budget, group) %>
</strong>
</div>
</div>
</div>
<% end %>
</div> </div>

View File

@@ -5,6 +5,7 @@ en:
title: Your ballot title: Your ballot
amount_spent: Amount spent amount_spent: Amount spent
remaining: "You still have <span>%{amount}</span> to invest." remaining: "You still have <span>%{amount}</span> to invest."
no_balloted_group_yet: "You have not voted on this group yet, go vote!"
remove: Remove vote remove: Remove vote
voted_html: voted_html:
one: "You have voted <span>one</span> proposal." one: "You have voted <span>one</span> proposal."

View File

@@ -5,6 +5,7 @@ es:
title: Mis votos title: Mis votos
amount_spent: Coste total amount_spent: Coste total
remaining: "Te quedan <span>%{amount}</span> para invertir" remaining: "Te quedan <span>%{amount}</span> para invertir"
no_balloted_group_yet: "Todavía no has votado proyectos de este grupo, ¡vota!"
remove: Quitar voto remove: Quitar voto
voted_html: voted_html:
one: "Has votado <span>una</span> propuesta." one: "Has votado <span>una</span> propuesta."

View File

@@ -350,6 +350,18 @@ feature 'Ballots' do
end end
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 end
scenario 'Removing investments from ballot', :js do scenario 'Removing investments from ballot', :js do