fixed a large number of bugs in the software (see wiki) over a days work
[selectricity-live] / app / views / common / details.rhtml
similarity index 50%
rename from app/views/voter/details.rhtml
rename to app/views/common/details.rhtml
index cf73f4189c7ae52865b0e163585bb46baa1aeac6..ae09c2975b7821ee5fdc292482fd51a455d70abe 100644 (file)
@@ -1,3 +1,6 @@
+<% @votes = @election.votes.select {|v| v.confirmed? }.shuffle %>
+<% @voters = @votes.collect {|v| v.voter}.shuffle %>
+
 <div id="title-header">
   <span class="header">Details</span>
   <span class="subheader"><%= @election.name %></span>
 <div id="title-header">
   <span class="header">Details</span>
   <span class="subheader"><%= @election.name %></span>
@@ -11,27 +14,35 @@ election:</p>
 
 <ol>
 <%- @voters.each do |voter| -%>
 
 <ol>
 <%- @voters.each do |voter| -%>
-<li><%= voter.email %></li>
+<li><% if voter.email %>
+       <%= voter.email %>
+    <% elsif @election.kiosk? %>
+       Kiosk Voter
+    <% else %>
+       Unknown voter
+    <% end %></li>
 <%- end -%>
 </ol>
 
 <p>The following table lists the votes cast in random order.</p>
 
 <%- end -%>
 </ol>
 
 <p>The following table lists the votes cast in random order.</p>
 
-<p>The column marked <em>Verification Token</em> lists tokens that were
-given to voters at the time of voting. Voters can check to see that the
-vote that corresponds to their token was recorded correctly. The column
-marked <em>Vote</em> lists the candidates in order of the voter's
-preference. To read these votes, refer to the key below.</p>
+<p><% if @election.verifiable %>The column marked <em>Verification
+Token</em> lists tokens that were given to voters at the time of voting.
+Voters can check to see that the vote that corresponds to their token
+was recorded correctly.<% end %> The column marked <em>Vote</em> lists
+the candidates in order of the voter's preference. To read these votes,
+refer to the key below.</p>
 
 <table class="preftable">
 <tr>
 <th></th>
 
 <table class="preftable">
 <tr>
 <th></th>
-<th>Verification Token</th>
+<% if @election.verifiable %><th>Verification Token</th><% end %>
 <th>Vote</th>
 <%- @votes.each_with_index do |vote, i| -%>
 <tr>
 <td><%= i + 1 %></td>
 <th>Vote</th>
 <%- @votes.each_with_index do |vote, i| -%>
 <tr>
 <td><%= i + 1 %></td>
-<td><%= vote.token %></td><td><%= vote.votestring%></td>
+<% if @election.verifiable %><td><%= vote.token %></td><% end %>
+<td><%= vote.votestring%></td>
 </tr>
 <%- end -%>
 </table>
 </tr>
 <%- end -%>
 </table>

Benjamin Mako Hill || Want to submit a patch?