In the middle of adding custom theme supports. Skin_pictures table added to store...
[selectricity-live] / app / controllers / election_controller.rb
index 6faaf22bd0f28548b407b1a4bc6a0e7d0a2b91ea..becba6b161d7cc9781b6c2cc365ecfdd3adad2f9 100644 (file)
@@ -62,6 +62,11 @@ class ElectionController < ApplicationController
   
   def update_general_information
     @election = Election.find(params[:id])
+    
+    if params[:skin_picture]
+      add_theme
+    end
+    
     if @election.update_attributes(params[:election])
       flash[:notice] = 'Election was successfully updated.'
       redirect_to :action => 'show', :id => @election
@@ -69,13 +74,22 @@ class ElectionController < ApplicationController
       render :action => 'edit'
     end
   end
-
+  
+  def add_theme
+    debugger
+    skin_picture = SkinPicture.new(params[:skin_picture])
+    skin_picture.save
+  end
 
   def show
     @sidebar_content = render_to_string :partial => 'progress',
                                         :locals => { :page => 'review' }
 
     @election = Election.find(params[:id])
+    if @election.type == QuickVote
+      redirect_to(:controller => 'quickvote', :action => 'index', :ident => @election.id)
+    end
+      
   end
 
   def start_election
@@ -169,7 +183,7 @@ class ElectionController < ApplicationController
   def results
     @election = Election.find( params[:id] )
     votes = []
-
+    
     @election.voters.each do |voter|
       if voter.vote and voter.vote.confirmed?
         votes << voter.vote.rankings.sort.collect {|vote| vote.candidate_id}
@@ -182,6 +196,7 @@ class ElectionController < ApplicationController
     
     @candidates_by_id = {}
     @election.candidates.each {|cand| @candidates_by_id[cand.id] = cand}
+    
   end
   
   def detailed_results
@@ -190,7 +205,8 @@ class ElectionController < ApplicationController
 
     @voter_list = []
     @vote_list = []
-    @election.voters. each do |voter|
+    
+    @election.voters.each do |voter|
       if voter.vote and voter.vote.confirmed?
         @voter_list << voter.email
              @vote_list << voter.vote

Benjamin Mako Hill || Want to submit a patch?