]> projects.mako.cc - selectricity-live/commitdiff
fixed up a series of things in prepration for the stress test on friday
authorBenjamin Mako Hill <mako@atdot.cc>
Thu, 18 Jun 2009 00:53:40 +0000 (20:53 -0400)
committerBenjamin Mako Hill <mako@atdot.cc>
Thu, 18 Jun 2009 00:53:40 +0000 (20:53 -0400)
app/controllers/application.rb
app/controllers/quickvote_controller.rb
app/controllers/voter_controller.rb
app/views/front/index.rhtml
app/views/layouts/frontpage.rhtml

index 7be877afa8cbf011e4da5385feae4fe0a6d35f05..bdd11e8c425f98ce927c8d950a5fbdd7977b4c91 100644 (file)
@@ -36,7 +36,6 @@ class ApplicationController < ActionController::Base
 
   #both election_controller and quickvote_controller need this method
   def sort_candidates
 
   #both election_controller and quickvote_controller need this method
   def sort_candidates
-    
     @vote = Vote.find(params[:id])
     
     @vote.rankings.each do |ranking|
     @vote = Vote.find(params[:id])
     
     @vote.rankings.each do |ranking|
index 066fd6ba463635c12af56ea07b9e5e449d998294..4b3c0c988d75544b3b9f93945a48e8a016f3fec0 100644 (file)
@@ -97,6 +97,13 @@ class QuickvoteController < ApplicationController
     # if the person has specified an election, we show them the voting
     # page. otherwise, we redirect back to main the page
     if @election
     # if the person has specified an election, we show them the voting
     # page. otherwise, we redirect back to main the page
     if @election
+
+      # if the election is over, redirect to the the results page
+      unless @election.active?
+        redirect_to quickaction_url(:ident => params[:ident],
+                                    :action => 'results')
+      end
+
       # look to see that the voter has been created and has voted in
       # this election, and has confirmed their vote
       @voter = QuickVoter.find(:all,
       # look to see that the voter has been created and has voted in
       # this election, and has confirmed their vote
       @voter = QuickVoter.find(:all,
index 1634ccd1a86d4854f96f6b5922154d26139accfe..5d729a6752800f7f799666b3c45d3bc38ceca375 100644 (file)
@@ -13,7 +13,7 @@ class VoterController < ApplicationController
   require_dependency "election"
 
   before_filter :authenticate, :except => [:index, :login, :reminder,
   require_dependency "election"
 
   before_filter :authenticate, :except => [:index, :login, :reminder,
-                                           :kiosk_ready]
+                                           :kiosk_ready, :sort_candidates]
 
   def index
     if params[:election_id]
 
   def index
     if params[:election_id]
@@ -54,18 +54,24 @@ class VoterController < ApplicationController
       else
         @sidebar_content = render_to_string(:partial => 'vote_sidebar')
         if @election.embeddable? and params[:embed] == "true"
       else
         @sidebar_content = render_to_string(:partial => 'vote_sidebar')
         if @election.embeddable? and params[:embed] == "true"
-          #look for custom theme, and assign to instance variabels for widget use
+          # look for custom theme, and assign to instance variabels
+          # for widget use
           if @election.embed_custom_string
             @top_bar = SkinPicture.find(:first,
           if @election.embed_custom_string
             @top_bar = SkinPicture.find(:first,
-            :conditions => ["filename = ?", @election.embed_custom_string + "top_bar.png"])
+              :conditions => ["filename = ?",
+                @election.embed_custom_string + "top_bar.png"])
             @default_image = SkinPicture.find(:first,
             @default_image = SkinPicture.find(:first,
-            :conditions => ["filename = ?", @election.embed_custom_string + "default_image.png"])
+              :conditions => ["filename = ?",
+                @election.embed_custom_string + "default_image.png"])
             @bg1 = SkinPicture.find(:first,
             @bg1 = SkinPicture.find(:first,
-            :conditions => ["filename = ?", @election.embed_custom_string + "bg1.png"])
+              :conditions => ["filename = ?",
+                @election.embed_custom_string + "bg1.png"])
             @bg2 = SkinPicture.find(:first,
             @bg2 = SkinPicture.find(:first,
-            :conditions => ["filename = ?", @election.embed_custom_string + "bg2.png"])
+              :conditions => ["filename = ?",
+                @election.embed_custom_string + "bg2.png"])
             @bottom_bar = SkinPicture.find(:first,
             @bottom_bar = SkinPicture.find(:first,
-            :conditions => ["filename = ?", @election.embed_custom_string + "bottom_bar.png"])
+              :conditions => ["filename = ?",
+                @election.embed_custom_string + "bottom_bar.png"])
           end
           render :template => 'embed/full_vote', :layout => 'embed'
         else
           end
           render :template => 'embed/full_vote', :layout => 'embed'
         else
@@ -77,7 +83,8 @@ class VoterController < ApplicationController
 
   def login
     if params[:vote] and params[:vote][:password]
 
   def login
     if params[:vote] and params[:vote][:password]
-      redirect_to votepassword_url( :action => 'index', :urlpassword => params[:vote][:password])
+      redirect_to votepassword_url(:action => 'index',
+        :urlpassword => params[:vote][:password])
     else
       redirect_to :action => 'index'
     end
     else
       redirect_to :action => 'index'
     end
@@ -105,7 +112,8 @@ class VoterController < ApplicationController
   
   def reminder
     if params[:email]
   
   def reminder
     if params[:email]
-      voter_array= FullVoter.find(:all, :conditions => ["email = ?", params[:email]])
+      voter_array= FullVoter.find(:all,
+        :conditions => ["email = ?", params[:email]])
       voter_array.delete_if {|voter| voter.election.active == 0}
       unless voter_array.empty?
         VoterNotify.deliver_reminder(voter_array)
       voter_array.delete_if {|voter| voter.election.active == 0}
       unless voter_array.empty?
         VoterNotify.deliver_reminder(voter_array)
@@ -119,20 +127,27 @@ class VoterController < ApplicationController
        or @voter.election.enddate < Time.now
       
       @election = @voter.election
        or @voter.election.enddate < Time.now
       
       @election = @voter.election
-      @sidebar_content = render_to_string(:partial => 'full_results_sidebar')
+      @sidebar_content = \
+        render_to_string(:partial => 'full_results_sidebar')
 
 
-      #look for custom theme, and assign to instance variabels for widget use
+      # look for custom theme, and assign to instance variabels for
+      # widget use
       if @election.embed_custom_string
         @top_bar = SkinPicture.find(:first,
       if @election.embed_custom_string
         @top_bar = SkinPicture.find(:first,
-        :conditions => ["filename = ?", @election.embed_custom_string + "top_bar.png"])
+          :conditions => ["filename = ?",
+            @election.embed_custom_string + "top_bar.png"])
         @default_image = SkinPicture.find(:first,
         @default_image = SkinPicture.find(:first,
-        :conditions => ["filename = ?", @election.embed_custom_string + "default_image.png"])
+          :conditions => ["filename = ?",
+            @election.embed_custom_string + "default_image.png"])
         @bg1 = SkinPicture.find(:first,
         @bg1 = SkinPicture.find(:first,
-        :conditions => ["filename = ?", @election.embed_custom_string + "bg1.png"])
+          :conditions => ["filename = ?",
+            @election.embed_custom_string + "bg1.png"])
         @bg2 = SkinPicture.find(:first,
         @bg2 = SkinPicture.find(:first,
-        :conditions => ["filename = ?", @election.embed_custom_string + "bg2.png"])
+          :conditions => ["filename = ?",
+            @election.embed_custom_string + "bg2.png"])
         @bottom_bar = SkinPicture.find(:first,
         @bottom_bar = SkinPicture.find(:first,
-        :conditions => ["filename = ?", @election.embed_custom_string + "bottom_bar.png"])
+          :conditions => ["filename = ?",
+            @election.embed_custom_string + "bottom_bar.png"])
       end
       if @election.embeddable? and params[:embed] == "true"
         render :template => 'embed/results', :layout => 'embed'
       end
       if @election.embeddable? and params[:embed] == "true"
         render :template => 'embed/results', :layout => 'embed'
@@ -179,7 +194,7 @@ class VoterController < ApplicationController
                           session.session_id, election.id])[0]
 
         # when (a) there is no voter or (b) when there is a voter but
                           session.session_id, election.id])[0]
 
         # when (a) there is no voter or (b) when there is a voter but
-        # it's kiosk mode on the right page, rewrite with blank voter
+        # it's kiosk mode on the right page, rewrite with a blank voter
         if not(@voter) \
           or (params[:action] == 'kiosk_ready' and election.kiosk)
           @voter = OpenVoter.new unless @voter
         if not(@voter) \
           or (params[:action] == 'kiosk_ready' and election.kiosk)
           @voter = OpenVoter.new unless @voter
index 70cad25db4e23155241eb793748475b4c71df5f7..2acb64e7f9f4faac47bba10c600fd2560c698b6f 100644 (file)
     
     <%= render :partial => 'basic_login' %>
   
     
     <%= render :partial => 'basic_login' %>
   
-    <p>Full elections creation is not yet public. <a
-    href="mailto:team@selectricity.org">Contact us</a> for access.</p>
-    
-    <!-- <p>If you do not yet have an account, you should <%= link_to "create
-    one", :controller => 'account', :action => 'signup' %>.</p> -->
+    <p>If you do not yet have an account, you should <%= link_to "create
+    one", :controller => 'account', :action => 'signup' %>.</p>
   <% end %>
 
 
   <% end %>
 
 
index 9abd31e2c58156fce26eb827b2f300fe6c2a5a90..81c77dc014995599a07cfe78dde15d1a10af326c 100644 (file)
@@ -21,8 +21,8 @@
        <% else %>
       <%= link_to("login", :controller => "account", :action => "login")
       %>
        <% else %>
       <%= link_to("login", :controller => "account", :action => "login")
       %>
-      <!--&nbsp;&nbsp;<%= link_to "sign up", :controller => "account", 
-                                :action => "signup" %> -->
+      &nbsp;&nbsp;<%= link_to "sign up", :controller => "account", 
+                                :action => "signup" %> 
     <% end -%>
       &nbsp;&nbsp;<%= link_to "help/about", :controller => 'about' %>
       </div>
     <% end -%>
       &nbsp;&nbsp;<%= link_to "help/about", :controller => 'about' %>
       </div>

Benjamin Mako Hill || Want to submit a patch?