Embeddable elctions now scale based on how many candidates in the election there...
[selectricity] / app / views / embed / full_vote.rhtml
1 <div id="header">
2 <%= link_to '<img id="header_icon" src="/images/embed_header_icon.png" />',
3             {:controller => 'front'}, {:target => "_parent"} %><h2>Vote Now</h2>
4 </div>
5
6 <div id="voting-box" height="<%=(@election.candidates.length + 2)*53 %>px">
7         <%@election.candidates.length.times do |count|%>
8                 <% if (count%2)==0%>
9                         <img src="/images/widget_dark.png" 
10                         style="position:absolute;top:<%=(count+1)*53%>px;">
11                         <% else %>
12                         <img src="/images/widget_light.png" 
13                         style="position:absolute;top:<%=(count+1)*53%>px">
14                 <% end %>
15         <%end%>
16         
17         <ul id="rankings-list">
18                 
19                 
20                 
21       <% @voter.vote.rankings.each do |ranking| %>
22                 <li class="ranking" id="ranking_<%= ranking.candidate.id %>">
23                         <img alt="<%= white_list ranking.candidate.name %>"
24                  src="<% if ranking.candidate.picture -%>
25                       <%= url_for ranking.candidate.picture.public_filename(:thumb) -%>
26                      <%- else -%>
27                      /images/default_icon.png
28                      <%- end %>" />
29                         <p class="ranking-info">
30             <strong><%= white_list ranking.candidate.name %></strong><br />
31             <%= white_list ranking.candidate.description %></p>
32                 </li>
33       <% end %>
34         </ul>
35         
36         <div style="clear:both;"></div>
37         
38         <div id="voting-bottom" style="
39         <% if @election.candidates.length%2 == 0 %>
40         background-image:url(/images/bottom_dark.png)
41         <%else%>
42         background-image:url(/images/bottom_light.png)
43         <%end%>" >
44                 <div id="container">
45                         <a href="<%= url_for :action => :confirm, :id => @password, :embed => 'true' %>"><h2 id="submit_vote_button">Submit Vote</h2></a>
46                         <p><b>Drag and drop</b> to rank the choices.</p>
47                 </div>
48         </div>
49 </div>
50
51 <%= sortable_element 'rankings-list',
52     :url => { :action => "sort_candidates", :id => @voter.vote.id } %>
53

Benjamin Mako Hill || Want to submit a patch?