diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 55ad77a10..d31a7cf71 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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) diff --git a/app/helpers/wiki_page_versions_helper.rb b/app/helpers/wiki_page_versions_helper.rb index f68ab5c63..6b5dc94f9 100644 --- a/app/helpers/wiki_page_versions_helper.rb +++ b/app/helpers/wiki_page_versions_helper.rb @@ -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) diff --git a/app/javascript/src/styles/common/diffs.scss b/app/javascript/src/styles/common/diffs.scss index 2c8f99fa4..43a5bc9b3 100644 --- a/app/javascript/src/styles/common/diffs.scss +++ b/app/javascript/src/styles/common/diffs.scss @@ -10,7 +10,7 @@ } .removed, .removed a { - color: var(--dif-list-removed-color); + color: var(--diff-list-removed-color); text-decoration: line-through; margin-right: 0.5em; } diff --git a/app/javascript/src/styles/specific/wiki_page_versions.scss b/app/javascript/src/styles/specific/wiki_page_versions.scss index e5ffb6769..15921873e 100644 --- a/app/javascript/src/styles/specific/wiki_page_versions.scss +++ b/app/javascript/src/styles/specific/wiki_page_versions.scss @@ -1,15 +1,19 @@ div#c-wiki-page-versions { #a-diff { - del { + del, .wiki-other-names-diff-list .removed { background: var(--wiki-page-versions-diff-del-background); text-decoration: none; } - ins { + ins, .wiki-other-names-diff-list .added { background: var(--wiki-page-versions-diff-ins-background); text-decoration: none; } + .wiki-other-names-diff-list .obsolete { + text-decoration: dotted underline; + } + span.paragraph-mark { opacity: 0.25; } diff --git a/app/views/application/_diff_list.html.erb b/app/views/application/_diff_list.html.erb index de5ebda10..de5b7f510 100644 --- a/app/views/application/_diff_list.html.erb +++ b/app/views/application/_diff_list.html.erb @@ -1,21 +1,21 @@ -<%# diff %> +<%# diff, ul_class, li_class %> - +<% end %> diff --git a/app/views/wiki_page_versions/diff.html.erb b/app/views/wiki_page_versions/diff.html.erb index 3aeb38afc..5db443ace 100644 --- a/app/views/wiki_page_versions/diff.html.erb +++ b/app/views/wiki_page_versions/diff.html.erb @@ -6,9 +6,8 @@ <% if @thispage.visible? %>

Showing differences between <%= compact_time @thispage.updated_at %> (<%= link_to_user @thispage.updater %>) and <%= compact_time @otherpage.updated_at %> (<%= link_to_user @otherpage.updater %>)

-
- <%= wiki_other_names_diff(@thispage, @otherpage) %> -
+ <%= wiki_other_names_diff(@thispage, @otherpage) %> +
<%= wiki_body_diff(@thispage, @otherpage) %>