Changed quickvotes so that they take an identifier as opposed to just a
[selectricity-live] / app / views / quickvote / index.rhtml
index 84211ff77eb4c25e55bb324630769d57145f7b96..e7cac3d88f13de8d89892e233a4de5e192f7522e 100644 (file)
 <h2>Vote</h2>
 <% end %>
 
-<% if @voter.session_id %>
+<% if @voter.voted? %>
   <p>You have already voted. You can:</p>
   
   <ul>
-    <li><%= link_to "Change your vote.", quickaction_url( :votename => @voter.election.name, :action => 'change' ) %></li>
+    <li><%= link_to "Change your vote.", quickaction_url( :ident => @voter.election.name, :action => 'change' ) %></li>
 
-    <li><%= link_to "View election results.", quickaction_url( :votename => @voter.election.name, :action => 'results' ) %></li>
+    <li><%= link_to "View election results.", quickaction_url( :ident => @voter.election.name, :action => 'results' ) %></li>
   </ul>
 <% else %>
-  <%= render_partial 'voter/vote' %>
+
+<p>Drag and drop the items on the following list until they are in order
+from <em>most preferred at the top</em> to <em>least preferred at the
+bottom</em>. When you are done, press confirm to record your vote.</p>
+
+<div id="sortable_list">
+<ol id="rankings-list">
+  <% for ranking in @voter.vote.rankings %>
+    <li class="moveable" id="ranking_<%= ranking.candidate.id %>">
+      <%= ranking.candidate.name.capitalize %></li>
+  <% end %>
+</ol>
+</div>
+
+<div class="clearbox"></div>
+
+<%= button_to "Confirm Vote", quickaction_url( :action => 'confirm', :ident => @voter.election.name)  %>
+
+<%= sortable_element 'rankings-list',
+    :url => { :action => "sort_candidates" , :id => @voter.vote.id },
+    :complete => visual_effect(:highlight, 'rankings-list') %> 
+
 <% end %>

Benjamin Mako Hill || Want to submit a patch?