/wiki_page_versions/diff: use SetDiff to diff other_names.

Use SetDiff instead of DiffBuilder to generate diffs for wiki page other
names. SetDiff is what we use for artist other names.
This commit is contained in:
evazion
2020-01-12 15:32:34 -06:00
parent 95dd28fc52
commit 90b94adee8
6 changed files with 24 additions and 18 deletions

View File

@@ -1,9 +1,9 @@
require 'dtext'
module ApplicationHelper
def diff_list_html(new, old, latest)
def diff_list_html(new, old, latest, ul_class: ["diff-list"], li_class: [])
diff = SetDiff.new(new, old, latest)
render "diff_list", diff: diff
render "diff_list", diff: diff, ul_class: ul_class, li_class: li_class
end
def wordbreakify(string)

View File

@@ -12,9 +12,12 @@ module WikiPageVersionsHelper
status.join(" ")
end
def wiki_other_names_diff(thispage, otherpage)
pattern = Regexp.new('\S+|\s+')
DiffBuilder.new("#{thispage.other_names}\n\n", "#{otherpage.other_names}\n\n", pattern).build
def wiki_other_names_diff(new_version, old_version)
new_names = new_version.other_names
old_names = old_version.other_names
latest_names = new_version.wiki_page.other_names
diff_list_html(new_names, old_names, latest_names, ul_class: ["wiki-other-names-diff-list list-inline"], li_class: ["wiki-other-name"])
end
def wiki_body_diff(thispage, otherpage)