From d2eb87b3ce3d10f0e8d490d5e248c657125a68a8 Mon Sep 17 00:00:00 2001 From: Date: Wed, 5 Sep 2007 13:09:46 -0400 Subject: [PATCH 1/1] fixed up the results page in a number of ways --- app/views/quickvote/_methodinfo_borda.rhtml | 5 ++- .../quickvote/_methodinfo_condorcet.rhtml | 2 + .../quickvote/_methodinfo_plurality.rhtml | 4 +- app/views/quickvote/_pref_tables.rhtml | 21 ++++++--- app/views/quickvote/_result.rhtml | 12 +++--- app/views/quickvote/_results_sidebar.rhtml | 3 +- app/views/quickvote/results.rhtml | 4 ++ public/stylesheets/main.css | 43 +++++++++++++------ 8 files changed, 65 insertions(+), 29 deletions(-) diff --git a/app/views/quickvote/_methodinfo_borda.rhtml b/app/views/quickvote/_methodinfo_borda.rhtml index cc3167c..644522a 100644 --- a/app/views/quickvote/_methodinfo_borda.rhtml +++ b/app/views/quickvote/_methodinfo_borda.rhtml @@ -10,4 +10,7 @@ corresponding to the position in which he or she is ranked by each voter. Once all votes have been counted the candidate with the most points is the winner.

-<%= image_tag( graph_url( :action => 'borda_bar', :id => @election ) ) %> + +
+ <%= image_tag( graph_url( :action => 'borda_bar', :id => @election ) ) %> +
diff --git a/app/views/quickvote/_methodinfo_condorcet.rhtml b/app/views/quickvote/_methodinfo_condorcet.rhtml index a02c1d7..b1e7005 100644 --- a/app/views/quickvote/_methodinfo_condorcet.rhtml +++ b/app/views/quickvote/_methodinfo_condorcet.rhtml @@ -11,4 +11,6 @@ will be the winner.

"Simple Condorcet" to distinguish it from the Schulze method which is another Condorcet system.

+<%= render :partial => 'pref_tables' %> + diff --git a/app/views/quickvote/_methodinfo_plurality.rhtml b/app/views/quickvote/_methodinfo_plurality.rhtml index 9411611..bc27dc8 100644 --- a/app/views/quickvote/_methodinfo_plurality.rhtml +++ b/app/views/quickvote/_methodinfo_plurality.rhtml @@ -12,4 +12,6 @@ voting.

-<%= image_tag(graph_url( :action => 'plurality_pie', :id => @election ) )%> +
+ <%= image_tag(graph_url( :action => 'plurality_pie', :id => @election ) )%> +
diff --git a/app/views/quickvote/_pref_tables.rhtml b/app/views/quickvote/_pref_tables.rhtml index 588ec22..b9d41ec 100644 --- a/app/views/quickvote/_pref_tables.rhtml +++ b/app/views/quickvote/_pref_tables.rhtml @@ -4,12 +4,15 @@ <% victories = @election.ssd_result.victories_and_ties %> <% if candidates.size <= 7 -%> + +

Each number in the table below shows how many times the candidate on +the left beat the matching candidate on the top. The winner is on the +top of the left column.

+ +
- <% candidates.each do |candidate| -%> @@ -34,12 +37,15 @@ left column. <% end -%>
Each number shows how many times the candidate on the left beat the -matching candidate on the top. The Schulze/Condorcet winner is on the top of the -left column.
-
+
+ +

A simplification of the above data. The winner is on the left; each +cell names the defeated candidate and the magnitude of the victory in +parenthesis.

+ +
- <% candidates.each do |victor| %> @@ -56,5 +62,6 @@ names the defeated candidate and the magnitude of the victory in parenthesis. <% end -%>
A simplification of the above data. The winner is on the left; each cell -names the defeated candidate and the magnitude of the victory in parenthesis. -
<%=h @names[victor] %>
+
<% end -%> diff --git a/app/views/quickvote/_result.rhtml b/app/views/quickvote/_result.rhtml index e0ead6d..b0a3a85 100644 --- a/app/views/quickvote/_result.rhtml +++ b/app/views/quickvote/_result.rhtml @@ -1,10 +1,12 @@
-<% if result.winner? and result.winners.length == 1%> -

The winner is: - <%=h @candidates[result.winner].name.capitalize %>

+

+<% if result.winner? and result.winners.length == 1 -%> + The winner is: + <%=h @candidates[result.winner].name.capitalize %> <% elsif result.winner? and result.winners.length > 1 %> -

There was a tie. The winners are: <%=h( result.winners.collect {|w| @candidates[w].to_s.capitalize}.join(", ") )%>

+ There was a tie. The winners are: <%=h( result.winners.collect {|w| @candidates[w].to_s.capitalize}.join(", ") )%> <% else %> -

There is no winner using this method.

+

There is no winner using this method. <% end %> +

diff --git a/app/views/quickvote/_results_sidebar.rhtml b/app/views/quickvote/_results_sidebar.rhtml index 773db65..30047a4 100644 --- a/app/views/quickvote/_results_sidebar.rhtml +++ b/app/views/quickvote/_results_sidebar.rhtml @@ -1,5 +1,4 @@ -

Winner

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

Method

This election was run using: <%= ELECTION_TYPES[@election.election_method] %>

diff --git a/app/views/quickvote/results.rhtml b/app/views/quickvote/results.rhtml index 4c91538..5fd5f9e 100644 --- a/app/views/quickvote/results.rhtml +++ b/app/views/quickvote/results.rhtml @@ -5,6 +5,10 @@ Results +
+<%= render :partial => 'result', :object => @results[@election.election_method] %> +
+ <% if @election.shortdesc %>

Vote Description:

<%=h @election.shortdesc %> diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index 418e892..0260bc4 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -71,15 +71,9 @@ label { color: #666666; } -/* #graph { - margin-top: 50px; - background: url(/images/graph.jpg) top left no-repeat; - height: 0px; - overflow: hidden; - padding-top: 243px; -} */ - - +.graph { + text-align: center; +} /* Right column. Includes top-bar and main-box. */ @@ -266,6 +260,10 @@ li.moveable { float: left; } +.result_table { + text-align: center; + margin-bottom: 1em; +} .preftable { font-family: verdana,arial,helvetica,sans-serif; border-spacing: 0px; @@ -274,10 +272,7 @@ li.moveable { border-style: solid; caption-side: top; } -.preftable caption { - font-family: verdana,arial,helvetica,sans-serif; - font-size: 0.9em; -} + .preftable th { font-family: verdana,arial,helvetica,sans-serif; border-width: 2px; @@ -447,3 +442,25 @@ div.photo img { border: 1px black solid; } +.winner_text { + text-align: center; +} + +#winner_box { + border: 3px white solid; + background-color: #666666; + color: white; + margin: 0.5em 0 1em 0; +} + +.winner_text { + font-size: 1.2em; +} +#winner_box .winner_text { + font-size: 2em; +} + +#winner_box p { + margin: 0; + padding: 0; +} -- 2.39.5