Conditional that redircts to user profile page if too many elections in control panel...
[selectricity] / app / views / front / _user_summary.rhtml
index 3b541c8f49975859d28c1d49049985dac4001446..fd4ee6f5aff28c73a71c2ce5f010166e75da6be0 100644 (file)
@@ -1,11 +1,20 @@
 <% if @current_elections.length < 1 %>
   <p><em>You have not created any elections.</em></p>
 <% if @current_elections.length < 1 %>
   <p><em>You have not created any elections.</em></p>
+<% elsif @current_elections.length > 6 %>
+<p>You have more than six elections which may not fit on the control panel. Clcik on the following link to go to your user profile, which lists all your elections. <b/> 
+<%= link_to "Summary", :controller => "account", :action => "summary", :id => session[:user].id %> </p>
 <% else %>
   <ul>
   <% for election in @current_elections %>
 <% else %>
   <ul>
   <% for election in @current_elections %>
-    <li><%= link_to election.name, :controller => 'election', :action => 'show', :id => election.id %> (ends in <em><%=
-    distance_of_time_in_words Time.now, election.enddate %></em>)</li> 
+    <li><%= link_to election.name, :controller => 'election', :action => 'show', :id => election.id %>
+    <% if Time.now > election.enddate %>
+      (election over)
+    <% else %>
+      (ends in <em><%= distance_of_time_in_words Time.now, election.enddate %></em>)</li> 
+    <% end %>
   <% end %>
   </ul>
 <% end %>
 
   <% end %>
   </ul>
 <% end %>
 
+<p><%= link_to "Create a new election", :controller => 'election', :action => 'new' %>.</p>
+

Benjamin Mako Hill || Want to submit a patch?