]> projects.mako.cc - selectricity-live/blob - app/views/common/_results_sidebar.rhtml
Streamlined and made more consistent the code that checks for custom skin uploads...
[selectricity-live] / app / views / common / _results_sidebar.rhtml
1 <h2>Method</h2>
2
3 <p>This election was run using:
4 <strong><%= ELECTION_TYPES[@election.election_method] %></strong></p>
5
6 <p>View results using other methods:<br />
7 <% type_hash = {}; ELECTION_TYPES.each {|k,v| type_hash[v] = k} %>
8 <%= select_tag 'election_type_select', options_for_select(type_hash, @election.election_method) %></p>
9
10 <script>
11 var election_methods = new Array(<%= ELECTION_TYPES.keys.collect {|k| "'#{k}'"}.join(', ') %>);
12 var method_select = $('election_type_select'); 
13
14 function show_results_for() {
15   var test = $('test');
16
17   method_select.value;
18   var result_boxes = document.getElementsByClassName('resultbox');
19   for (i = 0; i < result_boxes.length; i++) {
20     result_box = result_boxes[i];
21     if (result_box.id == (method_select.value + "_result")) {
22       Element.show(result_box);
23     } else {
24       Element.hide(result_box);
25     }
26   }
27
28   //alert(method_select.value);
29 }
30
31 Event.observe(method_select, 'change', show_results_for);
32 </script>
33
34 <h2>Statistics</h2>
35 <%= image_tag( graph_url( :action => 'votes_per_interval', :id => @election ))%>
36 <br />
37 <br />
38

Benjamin Mako Hill || Want to submit a patch?