This commit is contained in:
albert
2012-01-07 20:14:56 -05:00
parent 37e2d36e8b
commit 4feb352f33
3 changed files with 13 additions and 13 deletions

View File

@@ -1,2 +1,14 @@
module PoolVersionsHelper
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.to_s + '">' + x.to_s + '</a></ins>'}.join(" ") + removed.map {|x| '<del>&ndash;<a href="/posts/' + x.to_s + '">' + x.to_s + '</a></del>'}.join(" ").html_safe
end
end

View File

@@ -1,14 +1,2 @@
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.to_s + '">' + x.to_s + '</a></ins>'}.join(" ") + removed.map {|x| '<del>&ndash;<a href="/posts/' + x.to_s + '">' + x.to_s + '</a></del>'}.join(" ")
end
end

View File

@@ -2,7 +2,7 @@
<div id="a-index">
<h1>Pool History</h1>
<table width="100%">
<table width="100%" class="striped">
<thead>
<tr>
<th>Pool</th>