Variety of improvements and additions:
[selectricity] / app / views / elections / list.rhtml
1 <% %>
2 <h1>Listing elections</h1>
3
4 <table cellpadding="10px">
5
6 <% for election in @elections %>
7   <tr>
8     <td valign="top"><h2><%= link_to election.name, :action => 'show', :id => election %></h2>
9         <p><strong>Description:</strong></p>
10         <blockquote><%= election.description %></blockquote>
11        
12         <p><strong>Election Information:</strong></p>
13         <ul>
14           <li><%= election.voters.length %> registered voters</li>
15           <li><%= "<strong>Not</strong> " unless election.anonymous == 1 %>Anonymous</li>
16           <li>Starts <%= election.startdate %></li>
17           <li>Ends <%= election.enddate %></li>
18         </ul> 
19     </td>
20     <td valign="top">
21         <p><strong>Candidates:</strong></p>
22         <% @election = election %><%= render :partial => 'candidate_list', :id => election.id %>
23     </td>
24     <td valign="top">
25         <%= link_to 'Destroy', { :action => 'destroy', :id => election }, :confirm => 'Are you sure?' %></td>
26   </tr>
27 <% end %>
28 </table>
29
30 <%= link_to 'Previous page', { :page => @election_pages.current.previous } if @election_pages.current.previous %>
31 <%= link_to 'Next page', { :page => @election_pages.current.next } if @election_pages.current.next %> 
32
33 <br />
34
35 <%= link_to 'New election', :action => 'new' %>

Benjamin Mako Hill || Want to submit a patch?