Files
nairobi/app/views/officing/voters/new.html.erb
voodoorai2000 e1141d1cd3 Display already voted message for budget polls
Budget polls behave slightly differently to non-budget polls.

In budget polls we use Budget::Ballot::Lines to verify if a user has already voted online. In non-budget polls we use Poll::Voter to verify this.

In this commit we are adding an extra check to make sure that the correct message is displayed if the user has already voted online for a budget poll[1]

[1] https://github.com/AyuntamientoMadrid/consul/blob/master/spec/features/budget_polls/voter_spec.rb#L122
2019-05-24 15:20:54 +02:00

38 lines
1.0 KiB
Plaintext

<%= back_link_to new_officing_residence_path %>
<h2><%= t("officing.voters.new.title") %></h2>
<% if @polls.any? %>
<table>
<thead>
<tr>
<th><%= t("officing.voters.new.table_poll") %></th>
<th><%= t("officing.voters.new.table_status") %></th>
<th class="text-center"><%= t("officing.voters.new.table_actions") %></th>
</tr>
</thead>
<tbody>
<% @polls.each do |poll| %>
<tr id="<%= dom_id(poll) %>">
<td>
<%= poll.name %>
</td>
<% if poll.votable_by?(@user) %>
<%= render "can_vote", poll: poll %>
<% elsif poll.voted_by?(@user) || poll.user_has_an_online_ballot?(@user) %>
<%= render "already_voted" %>
<% else %>
<%= render "cannot_vote" %>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% if Poll.votable_by(@user).any? %>
<div id="not_voted">
<%= link_to t("officing.voters.new.not_to_vote"), namespaced_root_path, class: "button" %>
</div>
<% end %>