fixed comment vote functional test

This commit is contained in:
albert
2011-04-01 19:01:17 -04:00
parent e7748e1fc9
commit cbd877d020
43 changed files with 135 additions and 20369 deletions

View File

@@ -1,2 +1,14 @@
module PostVotesHelper
def pool_version_diff(current)
prev = PoolVersion.where(["pool_id = ? and id < ?", current.pool_id, current.id]).order("id desc").first
if prev.nil?
return current.post_id_array.map {|x| content_tag("ins", "+#{x}")}.join(" ").html_safe
end
added = current.post_id_array - prev.post_id_array
removed = prev.post_id_array - current.post_id_array
added.map {|x| '<ins>+<a href="/posts/' + x + '">' + x + '</a></ins>'}.join(" ") + removed.map {|x| '<del>&ndash;<a href="/posts/' + x + '">' + x + '</a></del>'}.join(" ")
end
end