aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dudle.css3
-rw-r--r--participate.rb93
-rw-r--r--poll.rb20
3 files changed, 43 insertions, 73 deletions
diff --git a/dudle.css b/dudle.css
index 894b24b..975fa2b 100644
--- a/dudle.css
+++ b/dudle.css
@@ -84,6 +84,3 @@ h1 {
text-align: center;
}
-div#add_comment{
- float: left;
-}
diff --git a/participate.rb b/participate.rb
index 35bf0a6..b4a7f66 100644
--- a/participate.rb
+++ b/participate.rb
@@ -28,12 +28,34 @@ $htmlout += <<HEAD
<link rel="alternate" type="application/atom+xml" href="atom.cgi" />
</head>
<body>
- <div id='backlink'>
+<small>
<a href='..' style='text-decoration:none'>#{BACK}</a>
- </div>
- <h1>#{table.name}</h1>
+ <a href='config.cgi' style='text-decoration:none'>config</a>
HEAD
+
+# HISTORY
+MAXREV=VCS.revno
+REVISION=MAXREV unless defined?(REVISION)
+log = VCS.history
+log.collect!{|s| s.scan(/\nrevno:.*\ncommitter.*\n.*\ntimestamp: (.*)\nmessage:\n (.*)/).flatten}
+log.shift
+log.collect!{|t,c| [DateTime.parse(t),c]}
+$htmlout +=" history:"
+
+((REVISION-2)..(REVISION+2)).each do |i|
+ if i >0 && i<=MAXREV
+ $htmlout += " "
+ $htmlout += "<a href='?revision=#{i}' title='#{log[i-1][0].strftime('%d.%m, %H:%M')}: #{log[i-1][1]}'>" if REVISION != i
+ $htmlout += "#{i}"
+ $htmlout += "</a>" if REVISION != i
+ end
+end
+$htmlout += "</small>"
+
+
+# TABLE
+$htmlout += "<h1>#{table.name}</h1>"
if $cgi.include?("add_participant")
agreed = {}
$cgi.params.each{|k,v|
@@ -60,70 +82,5 @@ POLLTABLE
$htmlout += table.comment_to_html
-# ADD COMMENT
-$htmlout += <<ADDCOMMENT
-<div id='add_comment'>
- <fieldset>
- <legend>Comment</legend>
- <form method='post' action='.'>
- <div>
- <label for='Commentname'>Name: </label>
- <input id='Commentname' value='anonymous' type='text' name='commentname' />
- <br />
- <textarea cols='50' rows='7' name='comment' ></textarea>
- <br />
- <input type='submit' value='Submit comment' />
- </div>
- </form>
- </fieldset>
-</div>
-ADDCOMMENT
-
-# HISTORY
-MAXREV=VCS.revno
-REVISION=MAXREV unless defined?(REVISION)
-log = VCS.history
-log.collect!{|s| s.scan(/\nrevno:.*\ncommitter.*\n.*\ntimestamp: (.*)\nmessage:\n (.*)/).flatten}
-log.shift
-log.collect!{|t,c| [DateTime.parse(t),c]}
-$htmlout += <<HISTORY
-<div id='history'>
- <fieldset><legend>browse history</legend>
- <table>
- <tr>
- <th>rev</th>
- <th>time</th>
- <th>description of change</th>
- </tr>
-HISTORY
-
-((REVISION-2)..(REVISION+2)).each do |i|
- if i >0 && i<=MAXREV
- if REVISION == i
- $htmlout += "<tr id='displayed_revision'><td>#{i}"
- else
- $htmlout += "<tr><td>"
- $htmlout += "<a href='?revision=#{i}'>#{i}</a>"
- end
- $htmlout += "</td>"
- $htmlout += "<td>#{log[i-1][0].strftime('%d.%m, %H:%M')}</td>"
- $htmlout += "<td>#{log[i-1][1]}</td>"
- $htmlout += "</tr>"
- end
-end
-$htmlout += "</table>"
-$htmlout += "</fieldset>"
-$htmlout += "</div>"
-
-
-$htmlout +=<<CONFIG
-<div id='configlink'>
- <fieldset>
- <legend>Configure the Poll</legend>
- <a href='config.cgi' style='text-decoration:none'>config</a>
- </fieldset>
-</div>
-CONFIG
-
$htmlout += "</body>"
diff --git a/poll.rb b/poll.rb
index a219534..2b735f8 100644
--- a/poll.rb
+++ b/poll.rb
@@ -155,8 +155,9 @@ class Poll
end
def comment_to_html
ret = "<div id='comments'>"
+ ret += "<fieldset><legend>Comments</legend>"
+
unless @comment.empty?
- ret += "<fieldset><legend>Comments</legend>"
@comment.each_with_index{|c,i|
time,name,comment = c
ret += <<COMMENT
@@ -174,8 +175,23 @@ class Poll
</form>
COMMENT
}
- ret += "</fieldset>"
end
+
+ # ADD COMMENT
+ ret += <<ADDCOMMENT
+ <form method='post' action='.'>
+ <div>
+ <fieldset>
+ <legend>
+ <input value='anonymous' type='text' name='commentname' size='1' /> says
+ </legend>
+ <textarea cols='50' rows='7' name='comment' ></textarea>
+ <br /><input type='submit' value='Submit comment' />
+ </fieldset>
+ </div>
+ </form>
+ADDCOMMENT
+ ret += "</fieldset>"
ret += "</div>\n"
ret