From: Benjamin Mako Hill Date: Thu, 18 Jun 2009 00:53:40 +0000 (-0400) Subject: fixed up a series of things in prepration for the stress test on friday X-Git-Url: https://projects.mako.cc/source/selectricity/commitdiff_plain/5637ec97922038fa7a7cfe9f8aa13b1e3002abcd?ds=inline;hp=83a39529b634c0344a7884d5813e3f7e1a7dbcb4 fixed up a series of things in prepration for the stress test on friday --- diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 7be877a..bdd11e8 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -36,7 +36,6 @@ class ApplicationController < ActionController::Base #both election_controller and quickvote_controller need this method def sort_candidates - @vote = Vote.find(params[:id]) @vote.rankings.each do |ranking| diff --git a/app/controllers/quickvote_controller.rb b/app/controllers/quickvote_controller.rb index 066fd6b..4b3c0c9 100644 --- a/app/controllers/quickvote_controller.rb +++ b/app/controllers/quickvote_controller.rb @@ -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 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, diff --git a/app/controllers/voter_controller.rb b/app/controllers/voter_controller.rb index 1634ccd..5d729a6 100644 --- a/app/controllers/voter_controller.rb +++ b/app/controllers/voter_controller.rb @@ -13,7 +13,7 @@ class VoterController < ApplicationController require_dependency "election" before_filter :authenticate, :except => [:index, :login, :reminder, - :kiosk_ready] + :kiosk_ready, :sort_candidates] 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" - #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, - :conditions => ["filename = ?", @election.embed_custom_string + "top_bar.png"]) + :conditions => ["filename = ?", + @election.embed_custom_string + "top_bar.png"]) @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, - :conditions => ["filename = ?", @election.embed_custom_string + "bg1.png"]) + :conditions => ["filename = ?", + @election.embed_custom_string + "bg1.png"]) @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, - :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 @@ -77,7 +83,8 @@ class VoterController < ApplicationController 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 @@ -105,7 +112,8 @@ class VoterController < ApplicationController 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) @@ -119,20 +127,27 @@ class VoterController < ApplicationController 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, - :conditions => ["filename = ?", @election.embed_custom_string + "top_bar.png"]) + :conditions => ["filename = ?", + @election.embed_custom_string + "top_bar.png"]) @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, - :conditions => ["filename = ?", @election.embed_custom_string + "bg1.png"]) + :conditions => ["filename = ?", + @election.embed_custom_string + "bg1.png"]) @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, - :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' @@ -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 - # it's kiosk mode on the right page, rewrite witha 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 diff --git a/app/views/front/index.rhtml b/app/views/front/index.rhtml index 70cad25..2acb64e 100644 --- a/app/views/front/index.rhtml +++ b/app/views/front/index.rhtml @@ -31,11 +31,8 @@ <%= render :partial => 'basic_login' %> -

Full elections creation is not yet public. Contact us for access.

- - +

If you do not yet have an account, you should <%= link_to "create + one", :controller => 'account', :action => 'signup' %>.

<% end %> diff --git a/app/views/layouts/frontpage.rhtml b/app/views/layouts/frontpage.rhtml index 9abd31e..81c77dc 100644 --- a/app/views/layouts/frontpage.rhtml +++ b/app/views/layouts/frontpage.rhtml @@ -21,8 +21,8 @@ <% else %> <%= link_to("login", :controller => "account", :action => "login") %> - +   <%= link_to "sign up", :controller => "account", + :action => "signup" %> <% end -%>   <%= link_to "help/about", :controller => 'about' %>