This commit is contained in:
Toks
2013-04-01 20:53:39 -04:00
parent 8473676778
commit fab493bf40
3 changed files with 21 additions and 4 deletions

View File

@@ -302,11 +302,19 @@ div#c-post-versions, div#c-artist-versions {
margin-right: 0.5em; margin-right: 0.5em;
} }
ins.obsolete, ins.obsolete a {
color: darkGreen;
}
del, del a { del, del a {
color: red; color: red;
text-decoration: line-through; text-decoration: line-through;
margin-right: 0.5em; margin-right: 0.5em;
} }
del.obsolete, del.obsolete a {
color: darkRed;
}
} }
} }

View File

@@ -5,9 +5,15 @@ module PostVersionsHelper
diff[:added_tags].each do |tag| diff[:added_tags].each do |tag|
html << '<ins>+' + link_to(tag, posts_path(:tags => tag)) + '</ins>' html << '<ins>+' + link_to(tag, posts_path(:tags => tag)) + '</ins>'
end end
diff[:obsolete_added_tags].each do |tag|
html << '+<ins class="obsolete">' + link_to(tag, posts_path(:tags => tag)) + '</ins>'
end
diff[:removed_tags].each do |tag| diff[:removed_tags].each do |tag|
html << '<del>-' + link_to(tag, posts_path(:tags => tag)) + '</del>' html << '<del>-' + link_to(tag, posts_path(:tags => tag)) + '</del>'
end end
diff[:obsolete_removed_tags].each do |tag|
html << '-<del class="obsolete">' + link_to(tag, posts_path(:tags => tag)) + '</del>'
end
diff[:unchanged_tags].each do |tag| diff[:unchanged_tags].each do |tag|
html << '<span>' + link_to(tag, posts_path(:tags => tag)) + '</span>' html << '<span>' + link_to(tag, posts_path(:tags => tag)) + '</span>'
end end

View File

@@ -84,12 +84,15 @@ class PostVersion < ActiveRecord::Base
old_tags << "source:#{version.source}" if version.source.present? old_tags << "source:#{version.source}" if version.source.present?
end end
added_tags = new_tags - old_tags
removed_tags = old_tags - new_tags
return { return {
:added_tags => new_tags - old_tags, :added_tags => added_tags & latest_tags,
:removed_tags => old_tags - new_tags, :removed_tags => removed_tags - latest_tags,
:obsolete_added_tags => added_tags - latest_tags,
:obsolete_removed_tags => removed_tags & latest_tags,
:unchanged_tags => new_tags & old_tags, :unchanged_tags => new_tags & old_tags,
:obsolete_added_tags => new_tags - latest_tags,
:obsolete_removed_tags => old_tags & latest_tags,
} }
end end