Merge head
[selectricity-live] / app / views / quickvote / _results_sidebar.rhtml
1 <h2>Winner</h2>
2 <%= render :partial => 'result', :object => @results[@election.election_method] %>
3
4 <p>This election was run using:
5 <strong><%= ELECTION_TYPES[@election.election_method] %></strong></p>
6
7 <p>View results using other methods:<br />
8 <% type_hash = {}; ELECTION_TYPES.each {|k,v| type_hash[v] = k} %>
9 <%= select_tag 'election_type_select', options_for_select(type_hash, @election.election_method) %></p>
10
11 <script>
12 var election_methods = new Array(<%= ELECTION_TYPES.keys.collect {|k| "'#{k}'"}.join(', ') %>);
13 var method_select = $('election_type_select'); 
14
15 function show_results_for() {
16   var test = $('test');
17
18   method_select.value;
19   var result_boxes = document.getElementsByClassName('resultbox');
20   for (i = 0; i < result_boxes.length; i++) {
21     result_box = result_boxes[i];
22     if (result_box.id == (method_select.value + "_result")) {
23       Element.show(result_box);
24     } else {
25       Element.hide(result_box);
26     }
27   }
28
29   //alert(method_select.value);
30 }
31
32 Event.observe(method_select, 'change', show_results_for);
33 </script>
34
35 <h2>Statistics</h2>
36 <%= image_tag( graph_url( :action => 'votes_per_interval', :id => @election ))%>
37 <br />
38 <br />
39
40 <h2>Voter Report</h2>
41
42 <p><%= link_to "[View All Voters: Map and Other Info]", :controller => "quickvote",
43        :action => "list_voters", :id => @election.id %></p>
44

Benjamin Mako Hill || Want to submit a patch?