diff options
Diffstat (limited to '')
-rw-r--r-- | classic.css | 16 | ||||
-rw-r--r-- | default.css | 25 | ||||
-rw-r--r-- | poll.rb | 40 | ||||
-rw-r--r-- | print.css | 6 |
4 files changed, 47 insertions, 40 deletions
diff --git a/classic.css b/classic.css index 6fe50e0..e438404 100644 --- a/classic.css +++ b/classic.css @@ -27,10 +27,10 @@ a.comment_sort, a.top_bottom_ref { } -td.ayes, td.bmaybe, td.cno { cursor:default; } -td.ayes{ background-color:#0F0; } -td.cno { background-color:#F00; } -td.bmaybe { background-color:#FF0; } +td.a_yes__, td.b_maybe, td.c_no___ { cursor:default; } +td.a_yes__{ background-color:#0F0; } +td.c_no___ { background-color:#F00; } +td.b_maybe { background-color:#FF0; } td.undecided { background-color:#DDD;color:#666 } td.checkboxes { background-color: #DDD; @@ -42,9 +42,9 @@ table.checkboxes{ width: 100%; border-collapse: collapse; } -td.input-cno { background-color: #F00 } -td.input-ayes { background-color: #0F0} -td.input-bmaybe { background-color: #FF0} +td.input-c_no___ { background-color: #F00 } +td.input-a_yes__ { background-color: #0F0} +td.input-b_maybe { background-color: #FF0} label { cursor: pointer; } @@ -140,7 +140,7 @@ td { padding-right: 3px; } -td.sum, tr.participantrow, tr#add_participant, tr#summary { +tr.participantrow, tr#add_participant, tr#summary { background-color:Silver; } diff --git a/default.css b/default.css index 8239e9b..2eafd3d 100644 --- a/default.css +++ b/default.css @@ -36,11 +36,11 @@ a.comment_sort, a.top_bottom_ref { font-size: small; } -td.ayes, td.bmaybe, td.cno { cursor:default;} -td.ayes, tr.input-ayes td, input.chosen { background-color:#9C6} +td.a_yes__, td.b_maybe, td.c_no___ { cursor:default;} +td.a_yes__, tr.input-a_yes__ td, input.chosen { background-color:#9C6} input.chosen:hover { background-color: #8B5 } -td.cno, tr.input-cno td { background-color:#F96 } -td.bmaybe, tr.input-bmaybe td { background-color:#FF6} +td.c_no___, tr.input-c_no___ td { background-color:#F96 } +td.b_maybe, tr.input-b_maybe td { background-color:#FF6} td.undecided { background-color:#DDD } td.checkboxes { @@ -194,10 +194,25 @@ tr.participantrow{ background-color:#fff; } +tr#summary { + background-color:#eee; +} td.sum, tr#summary { margin-top:5ex; - background-color:#eee; } +td.sum{ color: #FFF} +td.match_100{background-color: #000000; } +td.match_90{ background-color: #111111; } +td.match_80{ background-color: #222222; } +td.match_70{ background-color: #333333; } +td.match_60{ background-color: #444444; } +td.match_50{ background-color: #555555; } +td.match_40{ background-color: #666666; } +td.match_30{ background-color: #777777; } +td.match_20{ background-color: #888888; } +td.match_10{ background-color: #999999; } +td.match_0{ background-color: #AAAAAA; } + td.polls { text-align:left; @@ -46,9 +46,9 @@ class String end class Poll attr_reader :head, :name - YESVAL = "ayes" - MAYBEVAL = "bmaybe" - NOVAL = "cno" + YESVAL = "a_yes__" + MAYBEVAL = "b_maybe" + NOVAL = "c_no___" def initialize name,type @name = name @@ -112,17 +112,19 @@ class Poll ret += "<tr class='participantrow'>\n" ret += userstring(participant,showparticipation) @head.columns.each{|column| - klasse = poll[column] - case klasse + case poll[column] when nil value = UNKNOWN klasse = "undecided" - when YESVAL + when /yes/ # allow anything containing yes (backward compatibility) value = YES - when NOVAL + klasse = YESVAL + when /no/ value = NO - when MAYBEVAL + klasse = NOVAL + when /maybe/ value = MAYBE + klasse = MAYBEVAL end ret += "<td class='#{klasse}' title=\"#{CGI.escapeHTML(participant)}: #{CGI.escapeHTML(column.to_s)}\">#{value}</td>\n" } @@ -140,9 +142,9 @@ class Poll yes = 0 undecided = 0 @data.each_value{|participant| - if participant[column] == YESVAL + if participant[column] =~ /yes/ yes += 1 - elsif !participant.has_key?(column) or participant[column] == MAYBEVAL + elsif !participant.has_key?(column) or participant[column] =~ /maybe/ undecided += 1 end } @@ -150,24 +152,14 @@ class Poll if @data.empty? percent_f = 0 else - percent_f = 100*yes/@data.size + percent_f = 100.0*yes/@data.size end - percent = "#{percent_f}%" unless @data.empty? + percent = "#{percent_f.round}%" unless @data.empty? if undecided > 0 - percent += "-#{(100.0*(undecided+yes)/@data.size).round}%" + percent += "-#{(100.0*(undecided+yes)/@data.size).round} %" end - ret += "<td id='sum_#{column.to_htmlID}' class='sum' title='#{percent}' style='" - ["","background-"].each {|c| - ret += "#{c}color: rgb(" - 3.times{ - ret += (c == "" ? "#{155+percent_f}" : "#{100-percent_f}") - ret += "," - } - ret.chop! - ret += ");" - } - ret += "'>#{yes}</td>\n" + ret += "<td id='sum_#{column.to_htmlID}' class='sum match_#{(percent_f/10).round*10}' title='#{percent}'>#{yes}</td>\n" } ret += "<td class='invisible'></td></tr>" @@ -153,9 +153,9 @@ tr#summary td.sum[title|='0%']{ } -td.ayes, input.chosen { background-color:#9c6; } -td.cno { background-color:#F96; } -td.bmaybe { background-color:#FF6; } +td.a_yes__, input.chosen { background-color:#9c6; } +td.c_no___ { background-color:#F96; } +td.b_maybe { background-color:#FF6; } td.undecided { background-color:#DDD;color:#666 } td.name { |