aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-23 18:33:27 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-23 18:33:27 +0100
commit73cb84647e97679cbd69a3ea87d49f72b950c3df (patch)
tree76f9bd4da5a1624dc8b15dcaf0c6297531329330
parent110633c45335705980ecf0565c8fc11ca95ceb66 (diff)
undo works!
-rw-r--r--dudle.css9
-rwxr-xr-xedit_columns.rb37
-rw-r--r--log.rb2
3 files changed, 29 insertions, 19 deletions
diff --git a/dudle.css b/dudle.css
index ea31ef6..e541010 100644
--- a/dudle.css
+++ b/dudle.css
@@ -92,12 +92,17 @@ table.calendarday td input{
padding: 1px;
}
+div.undo{
+ text-align: center;
+ margin-top: 2em;
+}
+
td.create_poll, td.settingstable{
- text-align:left;
+ text-align: left;
}
td.historycomment{
- text-align:left;
+ text-align: left;
}
td {
vertical-align:middle;
diff --git a/edit_columns.rb b/edit_columns.rb
index c449928..944c29f 100755
--- a/edit_columns.rb
+++ b/edit_columns.rb
@@ -84,29 +84,34 @@ TABLE
# ADD/REMOVE COLUMN
$html << table.edit_column_htmlform($cgi["editcolumn"],revno)
+$html << "<div class='undo'>"
h = VCS.history.flatten
-#undo = h.size -1
-
-#h.collect{|e|
-#
-#}
-
-
-
-# This Revision: #{revno}<br />
-# Hidden undo Revision: #{undorevision -1}<br />
-# Last Action: #{h[0]["commit message"]}
-
-$html << <<ADD_EDIT
+hidden = "<input type='hidden' name='add_remove_column_month' value='#{$cgi["add_remove_column_month"]}' />" if $cgi.include?("add_remove_column_month")
+if h.max
+ coltitle,action = h.max.comment.scan(/^Column (.*) (added|deleted|edited)$/).flatten
+ case action
+ when "added"
+ title = "Delete column #{coltitle}"
+ when "deleted"
+ title = "Add column #{coltitle}"
+ when "edited"
+ title = "Column #{coltitle} edit"
+ end
+ $html << <<ADD_EDIT
<form method='post' action=''>
<div>
- <input type='submit' value='Undo' />
- <input type='hidden' name='undo_revision' value='#{-1}' />
+ <input type='submit' title='#{title}' value='Undo' />
+ <input type='hidden' name='undo_revision' value='#{h.max.rev() -1}' />
+ #{hidden}
</div>
</form>
-#{h[216..234].to_html(220)}
ADD_EDIT
+end
+
+$html << h.to_html(1)
+$html << "</div>" #undo
+
$html << "</div></body>"
diff --git a/log.rb b/log.rb
index f1b4236..dd817ef 100644
--- a/log.rb
+++ b/log.rb
@@ -101,7 +101,7 @@ class Log
rev = max.rev
while rev > minrev
elem = self[rev]
- prevrev = elem.comment.scan(/^Reverted Poll to revision (\d*)$/).flatten[0]
+ prevrev = elem.comment.scan(/^Reverted Poll to version (\d*)$/).flatten[0]
if prevrev
rev = prevrev.to_i
else