1 class VoterController < ApplicationController
3 require_dependency "voter"
4 require_dependency "vote"
5 require_dependency "election"
8 if params[:urlpassword]
9 password = params[:urlpassword]
14 if @voter = FullVoter.find(:all, :conditions =>
15 [ "password = ?", password ] )[0]
16 @voter.vote = Vote.new if @voter.vote.nil?
17 @voter.vote.set_defaults! if @voter.vote.rankings.empty?
19 @election = @voter.election
20 @sidebar_content = render_to_string(:partial => 'sortable_vote')
21 render :action => 'full_vote'
22 elsif params[:urlpassword]
23 redirect_to :action => 'index'
28 if params[:vote] and params[:vote][:password]
29 redirect_to votepassword_url( :action => 'index', :urlpassword => params[:vote][:password])
31 redirect_to :action => 'index'
37 @voter.vote.time = Time.now
41 redirect_to :action => 'index'
48 render :action => 'thanks'
50 redirect_to :action => 'index'
56 voter_array= FullVoter.find(:all, :conditions => ["email = ?", params[:email]])
57 voter_array.delete_if {|voter| voter.election.active == 0}
58 unless voter_array.empty?
59 VoterNotify.deliver_reminder(voter_array)
61 render :action => 'reminder_sent'
68 password = params[:id]
69 @voter = FullVoter.find(:all, :conditions => [ "password = ?", password ] )[0]