# here has not been hitting this page and we can clear any
# candlist in the flash
flash.delete(:candlist) if flash.has_key?(:candlist)
+ @quickvote = QuickVote.new
end
end
@election.candidates.each {|c| @candidates[c.id] = c}
end
end
+
+
require 'date'
+ def initialize(params={})
+ super
+ self.enddate = read_attribute( :enddate ) || \
+ Time.now + 14.days - 1.second
+ end
+
def other_methods
if election_method
@other_methods = ELECTION_TYPES.reject {|i| i == election_method}
def startdate
read_attribute( :startdate ) || Time.now
end
-
- def enddate
- date = read_attribute( :enddate ) || Time.now + 14
- date - 1.second
- end
def enddate=(date)
date += 1.day
attr_accessor :raw_candidates
attr_accessor :reviewed
+ def initialize(params={})
+ super
+ 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 enddate
+ super(30)
+ end
+
def validate
if not @raw_candidates or @raw_candidates.length < 2
errors.add(nil, "You must list at least two candidates.")
errors.add(:name, " is a reserved word.")
end
end
-
- def initialize(params={})
- super
- self.startdate = Time.now
- self.enddate = Time.now + 30.days
- self.active = 1
- self.anonymous = 1
- end
def candidatelist=(candlist)
@raw_candidates = candlist
--- /dev/null
+
+<% fields_for 'quickvote', quickvote do |quickform| %>
+
+<span><label for="quickvote_election_method">Election Method</span><br />
+<%= quickform.select ('election_method',
+ %w(ssd condorcet plurality approval borda) ) %><br />
+
+<span><label for="quickvote_enddate">End Time</span><br />
+<%= quickform.date_select(:enddate) %><br />
+
+<% end %>
<%= text_area 'quickvote', 'description', :cols => 50, :rows => 4 %></p>
+<%= check_box('options', 'advanced',
+ :onclick => 'Element.toggle($("advanced")); false;' )%>Advanced
+
+<div id="advanced" style="display: none">
+<%= render :partial => 'advanced', :locals => {:quickvote => @quickvote} %>
+</div>
+<br />
+
<%= submit_tag "Create Quickvote" -%>
<% end %>
+
+
+
+
--- /dev/null
+require File.dirname(__FILE__) + '/../test_helper'
+
+class QuickVoteTest < Test::Unit::TestCase
+
+ def correct_enddate
+
+ end
+
+
+
+end
\ No newline at end of file