From c5d48f6ea92e43f07182d20ebe693692b4330437 Mon Sep 17 00:00:00 2001 From: Date: Wed, 29 Aug 2007 14:12:16 -0400 Subject: [PATCH] Major integration of Courtland's design into the QuickVotes. --- app/controllers/application.rb | 14 +- app/controllers/election_controller.rb | 4 + app/controllers/quickvote_controller.rb | 25 +++ app/views/election/_progress.rhtml | 3 +- app/views/election/_voter_list.rhtml | 7 +- app/views/election/edit_candidates.rhtml | 3 +- app/views/election/general_information.rhtml | 4 - app/views/election/new_voters.rhtml | 1 - app/views/layouts/_footer.rhtml | 2 +- app/views/layouts/main.rhtml | 8 +- app/views/quickvote/_advanced.rhtml | 27 --- app/views/quickvote/_create_sidebar.rhtml | 12 ++ app/views/quickvote/create.rhtml | 79 +++---- app/views/quickvote/index.rhtml | 22 +- app/views/quickvote/results.rhtml | 27 ++- app/views/quickvote/success.rhtml | 10 +- app/views/quickvote/thanks.rhtml | 14 +- public/stylesheets/common.css | 40 ++-- public/stylesheets/election.css | 13 ++ public/stylesheets/front.css | 25 ++- public/stylesheets/main.css | 212 +++---------------- public/stylesheets/quickvote.css | 12 ++ public/stylesheets/voter.css | 12 ++ vendor/plugins/sitealizer/lib/last_update | 2 +- 24 files changed, 269 insertions(+), 309 deletions(-) delete mode 100644 app/views/quickvote/_advanced.rhtml create mode 100644 app/views/quickvote/_create_sidebar.rhtml create mode 100644 public/stylesheets/election.css create mode 100644 public/stylesheets/quickvote.css create mode 100644 public/stylesheets/voter.css diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 9b48030..aeb2204 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -5,5 +5,17 @@ class ApplicationController < ActionController::Base include AuthenticatedSystem helper :user require_dependency "user" - + before_filter :add_stylesheets + + def initialize + @stylesheets = [] + end + + def add_stylesheets + file = "#{Dir.pwd}/public/stylesheets/#{controller_name}.css" + if File.exists? file + @stylesheets << controller_name + end + end + end diff --git a/app/controllers/election_controller.rb b/app/controllers/election_controller.rb index 4ad8bac..570f1fc 100644 --- a/app/controllers/election_controller.rb +++ b/app/controllers/election_controller.rb @@ -16,6 +16,8 @@ class ElectionController < ApplicationController end def general_information + @sidebar_content = render_to_string :partial => 'progress', + :locals => { :page => 'overview' } @election = Election.new render :action => 'general_information' end @@ -81,6 +83,8 @@ class ElectionController < ApplicationController # information for elections #################################################################### def edit_candidates + @sidebar_content = render_to_string :partial => 'progress', + :locals => { :page => 'candidates' } @election = Election.find( params[:id] ) end diff --git a/app/controllers/quickvote_controller.rb b/app/controllers/quickvote_controller.rb index cd63c2e..6886ca4 100644 --- a/app/controllers/quickvote_controller.rb +++ b/app/controllers/quickvote_controller.rb @@ -12,17 +12,41 @@ class QuickvoteController < ApplicationController def create if params[:quickvote] @quickvote = QuickVote.new(params[:quickvote]) + + # check to see if any of the advanced options have been changed + new_qv = QuickVote.new + if @quickvote.election_method != new_qv.election_method \ + or @quickvote.enddate.day != new_qv.enddate.day \ + or @quickvote.viewable != new_qv.viewable \ + or @quickvote.notices != new_qv.notices + show_advanced = true + end + end + + 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 @quickvote.candidate_names = flash[:candidate_names] @quickvote.description=@quickvote.description + #record who created the quickvote so that person can monitor it easily @quickvote.quickuser = session.session_id + #Give registered users additional QuickVote functionality @quickvote.user_id = session[:user][:id] if session[:user] + # try to save, if it fails, show the page again (the flash should # still be intact if @quickvote.save @quickvote = @quickvote.reload + # blank sidebar and show the success page + @sidebar_content = '' render :action => 'success' else flash.keep(:candidate_names) @@ -35,6 +59,7 @@ class QuickvoteController < ApplicationController flash.delete(:candidate_names) if flash.has_key?(:candidate_names) @quickvote = QuickVote.new end + end def add_candidate diff --git a/app/views/election/_progress.rhtml b/app/views/election/_progress.rhtml index 520894c..40beb60 100644 --- a/app/views/election/_progress.rhtml +++ b/app/views/election/_progress.rhtml @@ -2,12 +2,13 @@ ['candidates', 'Candidates'], ['voters', 'Voters'], ['review', 'Review'] ] %> +

Progress

diff --git a/app/views/quickvote/results.rhtml b/app/views/quickvote/results.rhtml index 0383b5e..8b658f7 100644 --- a/app/views/quickvote/results.rhtml +++ b/app/views/quickvote/results.rhtml @@ -1,9 +1,14 @@ -<% %> -<%require 'whois/whois' %> -

Results

+<% require 'whois/whois' %> + +
+ Quickvote + Results +
+ +
<% if @election.shortdesc %> -

Description:

+

Vote Description:

<%=h @election.shortdesc %> <% if @election.longdesc -%>
@@ -25,14 +30,21 @@ <%= @election.voters.reject {|v| not v.voted? }.length %> (see below for details)
-

Winners

+
+ Winner + +
<%= render :partial => 'result_' + @election.election_method, :object => @results[@election.election_method] %>
-

Other Voting Methods

+
+ Other Voting Methods + +
+ <% for result_type in @election.other_methods %>
<%= render :partial => 'result_' + result_type, @@ -41,7 +53,7 @@ <% end %> -
+

Voters <%= link_to "[Stalk Voters]", :controller => "quickvote", :action => "mapvoters", :id => @election.id %>

@@ -83,3 +95,4 @@ <%= image_tag( graph_url( :action => 'choices_positions', :id => @election ) ) %>
+ diff --git a/app/views/quickvote/success.rhtml b/app/views/quickvote/success.rhtml index 8d2baf6..95ae386 100644 --- a/app/views/quickvote/success.rhtml +++ b/app/views/quickvote/success.rhtml @@ -1,5 +1,10 @@ -<% -%> -

QuickVote Created

+
+ Quickvote + New QuickVote Created +
+
+ +

Please direct voters to:

@@ -14,3 +19,4 @@ HyperChad site. Voters do not need to log in or authenticate to participate in this election.

<%= link_to "Jump to QuickVote", quickvote_url( :ident => @quickvote.name ) %>

+
diff --git a/app/views/quickvote/thanks.rhtml b/app/views/quickvote/thanks.rhtml index 0fb3610..506677f 100644 --- a/app/views/quickvote/thanks.rhtml +++ b/app/views/quickvote/thanks.rhtml @@ -1,5 +1,10 @@ -<% %> -

Vote Recorded

+
+ Quickvote + Vote Recorded Successfully +
+ +
+

Your vote has been recorded with the following ranked preferences:

@@ -17,7 +22,4 @@ preferences:

  • <%= link_to "View Current Results", quickaction_url( :ident => @voter.election.name, :action => 'results' ) %>
  • - - - - +
    diff --git a/public/stylesheets/common.css b/public/stylesheets/common.css index 5e23927..9139066 100644 --- a/public/stylesheets/common.css +++ b/public/stylesheets/common.css @@ -28,25 +28,6 @@ table, caption, tbody, tfoot, thead, tr, th, td { vertical-align: baseline; } - -#body { - font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; - font-size: 12px; - text-align: left; - line-height: 1.5em; -} - -#body a { - text-decoration: underline; - color: inherit; - display: inline; - opacity: 0.8; -} - -#body a:hover { - opacity: .5; -} - /* tables still need 'cellspacing="0"' in the markup */ table { border-collapse: separate; @@ -97,9 +78,28 @@ h2, h3 { #footer a { text-decoration: none; - color: #dc0d13; } #footer a:hover { text-decoration: underline; } + +/* flash notices */ + +#notice { + background: #FFFBB3; + border: 1px black solid; + text-align: center; + font-weight: bold; + padding: 5px 5px 5px 15px; + width: 250px; +} + +#notice { + background: #FFFBB3; + border: 1px black solid; + text-align: center; + font-weight: bold; + padding: 5px 5px 5px 15px; + width: 250px; +} diff --git a/public/stylesheets/election.css b/public/stylesheets/election.css new file mode 100644 index 0000000..3e34a45 --- /dev/null +++ b/public/stylesheets/election.css @@ -0,0 +1,13 @@ +a { + color: #dc0d13; +} + +#page-title .header { + background-color: #dc0d13; +} + +#page-title .subheader { + color: #dc0d13; + background-color: #e5e5e5; +} + diff --git a/public/stylesheets/front.css b/public/stylesheets/front.css index 045055f..b206834 100644 --- a/public/stylesheets/front.css +++ b/public/stylesheets/front.css @@ -24,10 +24,33 @@ table, caption, tbody, tfoot, thead, tr, th, td { body { line-height: 1; - color: white; + color: black; background: #ffffff url(/images/bg_index.png) repeat-x top center; } +a { + color: #dc0d13 +} + +#body { + font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; + color: white; + font-size: 12px; + text-align: left; + line-height: 1.5em; +} + +#body a { + text-decoration: underline; + color: inherit; + display: inline; + opacity: 0.8; +} + +#body a:hover { + opacity: .5; +} + /* Header */ #header h1 { background: url(/images/title_front.png) center top no-repeat; diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index 185b48a..313dee5 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -1,4 +1,5 @@ @charset "utf-8"; + /* CSS Document */ /**************************************************************** @@ -31,6 +32,10 @@ h3 { pading: 0 1em 0 1em; } +label { + font-weight: bold; +} + /* Left column. Includes logo, poll information, and graph. */ @@ -147,37 +152,14 @@ h5 { overflow: hidden; } -#quickvote-title .header { - background-color: #74ce00; -} - -#quickvote-title .subheader { - color: #74ce00; - background-color: #e5e5e5; -} - -#controlroom-title .header { - background-color: #dc0d13; -} - -#controlroom-title .subheader { - color: #dc0d13; - background-color: #e5e5e5; -} - -#voters-title .header { - background-color: #005cd9; -} - -#voters-title .subheader { - color: #005cd9; - background-color: #e5e5e5; +.plain-header { + margin: 1em -1.2em 1em -1.2em; } .header { display: block; font-family: "trebuchet ms",trebuchet,verdana,arial,sans-serif; - font-size:30px; + font-size: 30px; text-transform: uppercase; text-align: center; color: white; @@ -209,66 +191,58 @@ h5 { border: 1px solid #b3b3b3; } -#main-box h1 { - +.main-content { + margin: 1.2em; + line-height: 1.5em; + text-color: #454545; } -#main-box p { - margin-bottom: 1.75em; - padding: 0 1.7em 0 1.7em; - line-height: 1.8em; - color: #454545; +.main-content p, .main-content blockquote, .main-content ul { + margin-bottom: 1em; } +blockquote { + margin-left: 3em; +} -#ErrorExplanation { - width: 400px; - border: 2px solid 'red'; - padding: 7px; - padding-bottom: 12px; + +/* css related to error in forms */ + +#errorExplanation { + border: 2px solid #C00; + width: 260px; margin-bottom: 20px; background-color: #f0f0f0; } -#ErrorExplanation h2 { +#errorExplanation h2 { + font-size: 1em !important; text-align: left; font-weight: bold; - padding: 5px 5px 5px 15px; - font-size: 12px; - margin: -7px; + padding: 5px 5px 5px 5px; background-color: #c00; color: #fff; } -#ErrorExplanation p { +#errorExplanation p { + font-size: 1em; color: #333; margin-bottom: 0; padding: 5px; } -#ErrorExplanation ul li { - font-size: 12px; +#errorExplanation ul li { + font-size: 1em; list-style: square; } -.ListLine0 { - background: #e0f8f8; - +.fieldWithErrors { + display: inline; } -.ListLine1 { - background: #cccccc; - +.fieldWithErrors input, .fieldWithErrors select, .fieldWithErrors textarea { + background-color: #FFFBB3; } -#notice { background: #FFFBB3; - text-align: left; - font-weight: bold; - border: 2px dotted 'red'; - margin-top: 10px; - margin-left: 50px; - padding: 5px 5px 5px 15px; - width: 400px; } - #status { width: 400px; border: 1px solid #0000FF; @@ -279,81 +253,6 @@ h5 { background-color: #f0f0f0; } -.fieldWithErrors { - display: inline; -} -.fieldWithErrors input, .fieldWithErrors select { - background-color: #ffdfdf; -} - -#xxErrorExplanation h2 { - text-align: left; - font-weight: bold; - padding: 5px 5px 5px 15px; - font-size: 12px; - margin: -7px; - background-color: #c00; - color: #fff; -} - -#xxErrorExplanation p { - color: #333; - margin-bottom: 0; - padding: 5px; -} - -#xxErrorExplanation ul li { - font-size: 12px; - list-style: square; -} - -.mainresultbox { - text-align: center; - width: 850px; - border-width: 2px; - border-style: solid; - border-color: #4D801A; - padding: 7px; - margin-right: 30px; - margin-bottom: 30px; -} - -.mainresultbox h3 { - text-align: center; - font-weight: bold; - padding: 5px 5px 5px 15px; - margin: -7px; - background-color: #73BF26; - color: #fff; - border-bottom: 0px; -} - -.resultbox { - text-align: center; - width: 400px; - float: left; - border-width: 2px; - border-style: solid; - border-color: #4D801A; - padding: 7px; - margin-right: 30px; - margin-bottom: 30px; -} - -.resultbox h3 { - text-align: center; - font-weight: bold; - padding: 5px 5px 5px 15px; - margin: -7px; - background-color: #73BF26; - color: #fff; - border-bottom: 0px; -} -.clearbox { - clear: both; - margin: 30px; -} - li.moveable { background-color: #E5FFCC; border:1px solid #4D801A; @@ -474,20 +373,10 @@ li.moveable { } #election_creation_progress_bar ul li { - display: inline; + display: block; list-style: default; } -#election_creation_progress_bar ul li:after { - font-weight: normal; - color: #000; - content: " || "; -} - -#election_creation_progress_bar ul li.last:after { - content: ""; -} - #election_creation_progress_bar li.step_selected { font-weight: bold; } @@ -497,36 +386,5 @@ li.moveable { font-weight: bold; } -/* -#plurality h4 { - background: url(/images/voting_plurality.png); - width: 217px; -} - -#schulze h4 { - background: url(/images/voting_schulze_quickvote.png); - width: 183px; -} - -#approval h4 { - background: url(/images/voting_approval.png); - width: 208px; -} - -#borda h4 { - background: url(/images/voting_borda.png); - width: 147px; -} - -#condorcet h4 { - background: url(/images/voting_condorcet.png); - width: 240px; -} - -#irv h4 { - background: url(/images/voting_irv.png); - width: 86px; -} -*/ diff --git a/public/stylesheets/quickvote.css b/public/stylesheets/quickvote.css new file mode 100644 index 0000000..d400dcf --- /dev/null +++ b/public/stylesheets/quickvote.css @@ -0,0 +1,12 @@ +a { + color: #569a00; +} + +#page-title .header { + background-color: #74ce00; +} + +#page-title .subheader { + color: #74ce00; + background-color: #e5e5e5; +} diff --git a/public/stylesheets/voter.css b/public/stylesheets/voter.css new file mode 100644 index 0000000..ec14c84 --- /dev/null +++ b/public/stylesheets/voter.css @@ -0,0 +1,12 @@ +a { + color: #005cd9; +} + +#page-title .header { + background-color: #005cd9; +} + +#page-title .subheader { + color: #005cd9; + background-color: #e5e5e5; +} diff --git a/vendor/plugins/sitealizer/lib/last_update b/vendor/plugins/sitealizer/lib/last_update index e6e4dc3..d393158 100644 --- a/vendor/plugins/sitealizer/lib/last_update +++ b/vendor/plugins/sitealizer/lib/last_update @@ -1 +1 @@ -Tue Aug 28 13:24:45 -0400 2007 +Wed Aug 29 13:54:03 -0400 2007 -- 2.30.2