From: John Dong Date: Fri, 31 Aug 2007 19:22:55 +0000 (-0400) Subject: Merge head X-Git-Url: https://projects.mako.cc/source/selectricity-live/commitdiff_plain/37ccb3a5511504b6b58c3fe70135e016d0a61bfd?hp=4559fe1efcc210dae16f5846dc49c2bde6e5c7cf Merge head --- diff --git a/app/controllers/election_controller.rb b/app/controllers/election_controller.rb index eff920f..1affe0f 100644 --- a/app/controllers/election_controller.rb +++ b/app/controllers/election_controller.rb @@ -152,6 +152,14 @@ class ElectionController < ApplicationController voter.destroy end + def remind_voter + 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) + end + end + ## methods for computing and printing results #################################################################### def results diff --git a/app/controllers/voter_controller.rb b/app/controllers/voter_controller.rb index 6693b0f..fb1bec7 100644 --- a/app/controllers/voter_controller.rb +++ b/app/controllers/voter_controller.rb @@ -32,7 +32,7 @@ class VoterController < ApplicationController redirect_to :action => 'index' end end - + private def authenticate password = params[:id] diff --git a/app/models/voter_notify.rb b/app/models/voter_notify.rb index d9fded5..825786a 100644 --- a/app/models/voter_notify.rb +++ b/app/models/voter_notify.rb @@ -8,7 +8,12 @@ class VoterNotify < ActionMailer::Base @body = { :voter => voter } end - def reminder(voter) + def reminder(voter_array) + @subject = "Selectricity Election Reminder!" + @recipients = voter_array[0].email + @from = MAIL_CONFIG[:from] + @sent_on = Time.now + @body = { :voter_array => voter_array } end end diff --git a/app/views/election/remind_voter.rhtml b/app/views/election/remind_voter.rhtml new file mode 100644 index 0000000..40d7a20 --- /dev/null +++ b/app/views/election/remind_voter.rhtml @@ -0,0 +1 @@ +The message has been sent, please check your inbox soon. \ No newline at end of file diff --git a/app/views/quickvote/_pref_tables.rhtml b/app/views/quickvote/_pref_tables.rhtml index 628ce55..3479167 100644 --- a/app/views/quickvote/_pref_tables.rhtml +++ b/app/views/quickvote/_pref_tables.rhtml @@ -1,8 +1,9 @@ -<% candidates = @election.condorcet_result.ranked_candidates.flatten -%> +<% candidates = @election.ssd_result.ranked_candidates.flatten -%> <% voters = @election.voters.size %> -<% matrix = @election.condorcet_result.matrix %> -<% victories = @election.condorcet_result.victories_and_ties %> +<% matrix = @election.ssd_result.matrix %> +<% victories = @election.ssd_result.victories_and_ties %> +<% if candidates.size <= 7 -%> @@ -30,7 +31,7 @@ <% end -%>
- +
<% candidates.each do |victor| %> @@ -49,3 +50,5 @@ <% end -%>
+<% end -%> + diff --git a/app/views/quickvote/_result_box.rhtml b/app/views/quickvote/_result_box.rhtml index 41d9d17..917dbd4 100644 --- a/app/views/quickvote/_result_box.rhtml +++ b/app/views/quickvote/_result_box.rhtml @@ -9,8 +9,11 @@ <% end %> +<% unless @election.election_method == method -%> +<%= render :partial => 'result', :object => @results[method]%> +<% end -%> <%= render :partial => 'methodinfo_' + method, - :object => @results[@election.election_method] %> + :object => @results[method] %> diff --git a/app/views/quickvote/_results_sidebar.rhtml b/app/views/quickvote/_results_sidebar.rhtml index d71d01f..f346b2e 100644 --- a/app/views/quickvote/_results_sidebar.rhtml +++ b/app/views/quickvote/_results_sidebar.rhtml @@ -34,4 +34,11 @@ Event.observe(method_select, 'change', show_results_for);

Statistics

<%= image_tag( graph_url( :action => 'votes_per_interval', :id => @election ))%> +
+
+ +

Voter Report

+ +

<%= link_to "[View All Voters: Map and Other Info]", :controller => "quickvote", + :action => "list_voters", :id => @election.id %>

diff --git a/app/views/quickvote/results.rhtml b/app/views/quickvote/results.rhtml index c0de537..4c91538 100644 --- a/app/views/quickvote/results.rhtml +++ b/app/views/quickvote/results.rhtml @@ -41,14 +41,6 @@
-
- Voter Report - -
- -

<%= link_to "[View All Voters]", :controller => "quickvote", :action => "list_voters", :id => @election.id %>

-
- diff --git a/app/views/voter/forgot_password.rhtml b/app/views/voter/forgot_password.rhtml new file mode 100644 index 0000000..43d1d03 --- /dev/null +++ b/app/views/voter/forgot_password.rhtml @@ -0,0 +1,12 @@ +

Deleted your email? Lost your password?

+

Not to worry, enter the email at which you were supposed to receive your +password, and we'll hook you up with a set of magic numbers that shall grant +access to the chambers within. Hoo-rah!

+ +<% form_tag :controller => 'election', :action => 'remind_voter' do %> + +

Email + <%= text_field_tag :email %>

+ + <%= submit_tag "Submit" %> +<% end -%> diff --git a/app/views/voter_notify/reminder.rhtml b/app/views/voter_notify/reminder.rhtml new file mode 100644 index 0000000..1373bc2 --- /dev/null +++ b/app/views/voter_notify/reminder.rhtml @@ -0,0 +1,17 @@ +Voter! + +Either you or an election administrator has requested you receive a reminder for an election you've been registered in. + +Here are the election(s) for which you are currently registered and your tokens to enter each election: +<% @voter_array.each do |voter| -%> +<%= voter.election.name %>: <%= voter.password %> +<% end -%> + + +If you feel there is a technical error, please contact: + + help@selectricity.org + (Selectricity Tech Support) + +Thanks and happy voting! +Selectricity Staff diff --git a/app/views/voter_notify/votestart.rhtml b/app/views/voter_notify/votestart.rhtml index 216ddeb..f9dbfc6 100644 --- a/app/views/voter_notify/votestart.rhtml +++ b/app/views/voter_notify/votestart.rhtml @@ -1,17 +1,17 @@ Voter! -This is an automated message sent by selectricity.media.mit.edu. +This is an automated message sent by Selectricity. You have been listed as a voter in an upcoming election. The election title: <%= @voter.election.name %> To read more about the election, the candidates, and to vote, you will -need to use the following token to log in to selectricity.media.mit.edu: +need to use the following token to log in to Selectricity: <%= @voter.password %> Alternatively, you can just click this URL: - http://selectricity.media.mit.edu<%= url_for :controller => 'election', :action => 'show', :id => @voter.election %> + http://selectricity.org<%= url_for :controller => 'voter' %> If you have any questions or if you feel you have received this message in error, you should contact: @@ -21,10 +21,9 @@ in error, you should contact: Alternatively, if you feel there is a technical error, please contact: - help@selectricity.media.mit.edu + help@selectricity.org (Selectricity Tech Support) Thanks and happy voting! Selectricity Staff - - + diff --git a/config/environment.rb b/config/environment.rb index ccd9ad0..3e5f1c6 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -59,7 +59,7 @@ end # Include your application configuration below -MAIL_CONFIG = { :from => 'Selectricity '} +MAIL_CONFIG = { :from => 'Selectricity '} require 'uniq_token' require 'randarray' diff --git a/config/gmaps_api_key.yml b/config/gmaps_api_key.yml index b0c65fb..b7ceca6 100644 --- a/config/gmaps_api_key.yml +++ b/config/gmaps_api_key.yml @@ -9,4 +9,4 @@ test: ABQIAAAAzMUFFnT9uH0xq39J0Y4kbhTJQa0g3IQ9GZqIMmInSLzwtGDKaBR6j135zrztfTGVOm2QlWnkaidDIQ production: - ABQIAAAA479zRK1hoNqMcKLTMuBcTRQ0mFvgRda1vOZQqJO6gQItognzGRQueA871M_O5_Q9Pd9xs4Ah4SNYTg + ABQIAAAA479zRK1hoNqMcKLTMuBcTRR0OKg4vZKrhw1amyo3djP_wIZS7BQ-fJouJ5VRd_fb2HO6KKzIMAVW6Q diff --git a/db/schema.rb b/db/schema.rb index 6c038de..e7d7d85 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -42,6 +42,14 @@ ActiveRecord::Schema.define() do t.column "rank", :integer end + create_table "sessions", :force => true do |t| + t.column "sessid", :string + t.column "data", :text + t.column "updated_at", :datetime + end + + add_index "sessions", ["sessid"], :name => "session_index" + create_table "sitealizer", :force => true do |t| t.column "path", :string t.column "ip", :string diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index 13626a1..a77ca83 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -274,14 +274,15 @@ li.moveable { } .preftable th { + font-family: verdana,arial,helvetica,sans-serif; border-width: 2px; border-color: #999999; border-style: solid; text-align: center; font-weight: bold; - padding: 5px 5px 5px 15px; + padding: 5px 5px 5px 5px; background-color: #999999; - color: #fff; + color: #FFFFFF; } .preftable td {