Added a list of recent votes to the homepage.
author<mako@atdot.cc> <>
Mon, 16 Oct 2006 18:47:17 +0000 (14:47 -0400)
committer<mako@atdot.cc> <>
Mon, 16 Oct 2006 18:47:17 +0000 (14:47 -0400)
app/controllers/site_controller.rb
app/views/site/index.rhtml

index 47ae2cbd87af5dbde48f59c1fdbb6feb44c92f4d..d5eab862c5326434d9bc6979be4cc85b2caa7eba 100644 (file)
@@ -3,6 +3,7 @@ class SiteController < ApplicationController
   model :user, :election
 
   def index
+    @quickvotes = QuickVote.find_all(["quickvote = 1"]).sort {|a,b| b.enddate <=> a.enddate}[0..1]
     # if the person claims they are logged in
     if session[:user]
 
index 9fd332b2f65472a10f570376e8bf5fe0cfc119ce..e89063dc3331416a79749f44fcb583df4119df7c 100644 (file)
@@ -13,6 +13,14 @@ methods.</p>
 
 <p><%= link_to "Create a QuickVote", :controller => 'quickvote', :action => 'create' %></p>
 
+<p>Recent <em>QuickVotes</em> include:</p>
+
+<ul>
+<% for quickvote in @quickvotes %>
+<li><%= link_to (quickvote.shortdesc || "Unnamed"), quickvote_url(:votename => quickvote.name) %></li>
+<% end %>
+</ul>
+
 <h2>Voters</h2>
 
 <p>If you have received an email with a token inviting you to vote in an

Benjamin Mako Hill || Want to submit a patch?