]> projects.mako.cc - selectricity/blob - app/controllers/site_controller.rb
Commit partial implementation of casting quickvotes via xmlrpc. WARNING: Currently...
[selectricity] / app / controllers / site_controller.rb
1 class SiteController < ApplicationController
2   layout 'main'
3   model :user, :election, :account
4
5   def index
6     @quickvotes = QuickVote.find(:all).sort {|a,b| b.enddate <=> a.enddate}[0..1]
7     # if the person claims they are logged in
8    
9     if logged_in?
10       # check to see that we actually have record of them
11       if User.exists?(session[:user])
12         username = User.find(session[:user]).login
13         # if we have record of them, grab the list of their elections
14         session[:user] = User.find(session[:user])
15         @current_elections = session[:user].elections.sort do |a,b|
16           b.enddate <=> a.enddate
17         end
18       else
19         # if we have no record of them, set the user back to
20               # nothing and start again
21         session[:user] = nil
22         
23       end
24     end
25   end
26
27 end

Benjamin Mako Hill || Want to submit a patch?