Implentation for #2141

This commit is contained in:
Toks
2014-05-22 20:07:15 -04:00
parent 47f56cd19d
commit b18bb73f4b
14 changed files with 96 additions and 5 deletions

View File

@@ -48,4 +48,24 @@ module WikiPageVersionsHelper
output.join.gsub(/\r?\n/, '<br>').html_safe
end
def wiki_page_other_names_diff(thispage, otherpage)
new_names = otherpage.other_names_array
old_names = thispage.other_names_array
added_names = new_names - old_names
removed_names = old_names - new_names
unchanged_names = new_names & old_names
html = []
added_names.each do |name|
html << '<ins>' + name + '</ins>'
end
removed_names.each do |name|
html << '<del>' + name + '</del>'
end
unchanged_names.each do |name|
html << '<span>' + name + '</span>'
end
return html.join(" ").html_safe
end
end

View File

@@ -47,4 +47,9 @@ module WikiPagesHelper
html.html_safe
end
def wiki_page_other_names_list(wiki_page)
names_html = wiki_page.other_names_array.map{|name| content_tag("span", name, :class => "other-name")}
names_html.join(", ").html_safe
end
end