fixes #2869: Add way to differentiate Pool Descriptions from Pool History

This commit is contained in:
r888888888
2017-02-14 16:03:19 -08:00
parent aa41c41572
commit f374eec4a1
7 changed files with 61 additions and 11 deletions

View File

@@ -1,22 +1,19 @@
module PoolVersionsHelper
def pool_version_diff(pool_version)
def pool_version_diff(pool_version, previous = nil, options = {})
html = ""
html << pool_version.added_post_ids.map do |post_id|
diff = pool_version.build_diff(previous)
html << diff[:added_post_ids].map do |post_id|
'<ins><a href="/posts/' + post_id.to_s + '">' + post_id.to_s + '</a></ins>'
end.join(" ")
html << " "
html << pool_version.removed_post_ids.map do |post_id|
html << diff[:removed_post_ids].map do |post_id|
'<del><a href="/posts/' + post_id.to_s + '">' + post_id.to_s + '</a></del>'
end.join(" ")
if pool_version.description_changed?
html << '<ins>desc:' + h(pool_version.description) + '</ins> '
html << '<del>desc:' + h(pool_version.previous.description) + '</del> '
end
return html.html_safe
end
end