From: Date: Wed, 29 Aug 2007 20:54:17 +0000 (-0400) Subject: Updated quickvote creation to fix expanding and unexpanding. X-Git-Url: https://projects.mako.cc/source/selectricity/commitdiff_plain/108e84df50f2395c475886a83da9f1799b4b29cc?hp=02203b910ea1c80dbbbe83e344b9309ce4351ea2 Updated quickvote creation to fix expanding and unexpanding. --- diff --git a/app/controllers/quickvote_controller.rb b/app/controllers/quickvote_controller.rb index 6886ca4..ea7711f 100644 --- a/app/controllers/quickvote_controller.rb +++ b/app/controllers/quickvote_controller.rb @@ -25,10 +25,6 @@ class QuickvoteController < ApplicationController show_advanced ||= false - # render the sidebar - @sidebar_content = render_to_string(:partial => 'create_sidebar', - :locals => {:show_advanced => show_advanced}) - if params[:quickvote] # store the candidate grabbed through ajax and stored in flash @@ -49,6 +45,9 @@ class QuickvoteController < ApplicationController @sidebar_content = '' render :action => 'success' else + # render the sidebar + @sidebar_content = render_to_string(:partial => 'create_sidebar', + :locals => {:show_advanced => show_advanced}) flash.keep(:candidate_names) end @@ -58,6 +57,8 @@ class QuickvoteController < ApplicationController # candidate_names list in the flash flash.delete(:candidate_names) if flash.has_key?(:candidate_names) @quickvote = QuickVote.new + @sidebar_content = render_to_string(:partial => 'create_sidebar', + :locals => {:show_advanced => show_advanced}) end end diff --git a/app/models/election.rb b/app/models/election.rb index a77f445..9c6337f 100644 --- a/app/models/election.rb +++ b/app/models/election.rb @@ -18,7 +18,7 @@ class Election < ActiveRecord::Base def initialize(params={}) super self.enddate = read_attribute( :enddate ) || \ - Time.now + 14.days - 1.second + Time.now + 30.days - 1.second end def other_methods @@ -34,12 +34,6 @@ class Election < ActiveRecord::Base read_attribute( :startdate ) || Time.now end - def enddate=(date) - date += 1.day - date = Time.gm(*date) - super(date) - end - def votes votes = Array.new self.voters.each do |voter| diff --git a/app/models/quick_vote.rb b/app/models/quick_vote.rb index e0bab76..de78813 100644 --- a/app/models/quick_vote.rb +++ b/app/models/quick_vote.rb @@ -11,8 +11,6 @@ class QuickVote < Election self.startdate = Time.now self.active = 1 self.anonymous = 1 unless self.anonymous - self.enddate = read_attribute( :enddate ) || \ - Time.now + 30.days - 1.second end def validate