]> projects.mako.cc - selectricity/blob - app/controllers/front_controller.rb
Suppress description of voter-verifiability unless election is verifiable.
[selectricity] / app / controllers / front_controller.rb
1 # Selectricity: Voting Machinery for the Masses
2 # Copyright (C) 2007, 2008 Benjamin Mako Hill <mako@atdot.cc>
3 # Copyright (C) 2007 Massachusetts Institute of Technology
4 #
5 # This program is free software. Please see the COPYING file for
6 # details.
7
8 class FrontController < ApplicationController
9   layout 'frontpage'
10   require_dependency "user"
11   require_dependency "election"
12   require_dependency "account"
13
14   def index
15     @quickvotes = QuickVote.find(:all).sort {|a,b| b.startdate <=> a.startdate}[0..1]
16     # if the person claims they are logged in
17    
18     if logged_in?
19       # check to see that we actually have record of them
20       if User.exists?(session[:user])
21         username = User.find(session[:user]).login
22         # if we have record of them, grab the list of their elections
23         session[:user] = User.find(session[:user])
24         @current_elections = session[:user].elections.sort do |a,b|
25           b.enddate <=> a.enddate
26         end
27       else
28         # if we have no record of them, set the user back to
29               # nothing and start again
30         session[:user] = nil
31       end
32     end
33   end
34
35 end

Benjamin Mako Hill || Want to submit a patch?