added support for drag and drop preferential quick voting
[selectricity-live] / app / views / quickvote / index.rhtml
index 84211ff77eb4c25e55bb324630769d57145f7b96..bb0b5a4705623d91e2cc7a5bb29ab4d771c07831 100644 (file)
@@ -13,7 +13,7 @@
 <h2>Vote</h2>
 <% end %>
 
-<% if @voter.session_id %>
+<% if @voter.voted? %>
   <p>You have already voted. You can:</p>
   
   <ul>
     <li><%= link_to "View election results.", quickaction_url( :votename => @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
+<em>from most preferred at the top to 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', :votename => @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?