Merge branch 'master' of github.com:r888888888/danbooru
This commit is contained in:
@@ -3,16 +3,12 @@ module PostVersionsHelper
|
|||||||
diff = post_version.diff(post_version.previous)
|
diff = post_version.diff(post_version.previous)
|
||||||
html = []
|
html = []
|
||||||
diff[:added_tags].each do |tag|
|
diff[:added_tags].each do |tag|
|
||||||
html << '<ins>+' + link_to(tag, posts_path(:tags => tag)) + '</ins>'
|
prefix = diff[:obsolete_added_tags].include?(tag) ? '+<ins class="obsolete">' : '<ins>+'
|
||||||
end
|
html << prefix + link_to(tag, posts_path(:tags => tag)) + '</ins>'
|
||||||
diff[:obsolete_added_tags].each do |tag|
|
|
||||||
html << '+<ins class="obsolete">' + link_to(tag, posts_path(:tags => tag)) + '</ins>'
|
|
||||||
end
|
end
|
||||||
diff[:removed_tags].each do |tag|
|
diff[:removed_tags].each do |tag|
|
||||||
html << '<del>-' + link_to(tag, posts_path(:tags => tag)) + '</del>'
|
prefix = diff[:obsolete_removed_tags].include?(tag) ? '-<del class="obsolete">' : '<del>-'
|
||||||
end
|
html << prefix + link_to(tag, posts_path(:tags => tag)) + '</del>'
|
||||||
diff[:obsolete_removed_tags].each do |tag|
|
|
||||||
html << '-<del class="obsolete">' + link_to(tag, posts_path(:tags => tag)) + '</del>'
|
|
||||||
end
|
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>'
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ class PostVersion < ActiveRecord::Base
|
|||||||
removed_tags = old_tags - new_tags
|
removed_tags = old_tags - new_tags
|
||||||
|
|
||||||
return {
|
return {
|
||||||
:added_tags => added_tags & latest_tags,
|
:added_tags => added_tags,
|
||||||
:removed_tags => removed_tags - latest_tags,
|
:removed_tags => removed_tags,
|
||||||
:obsolete_added_tags => added_tags - latest_tags,
|
:obsolete_added_tags => added_tags - latest_tags,
|
||||||
:obsolete_removed_tags => removed_tags & latest_tags,
|
:obsolete_removed_tags => removed_tags & latest_tags,
|
||||||
:unchanged_tags => new_tags & old_tags,
|
:unchanged_tags => new_tags & old_tags,
|
||||||
|
|||||||
Reference in New Issue
Block a user