Rework wiki page versions index/diff views
- Changed to using the diff-body CSS class -- Removed unnecessary elements from the CSS style file - Does a symmetric difference on the array fields to detect differences - Add more descriptors to the status/changes column - Specifically add <br> to statuses to cause line breaks
This commit is contained in:
@@ -1,21 +1,4 @@
|
||||
module WikiPageVersionsHelper
|
||||
def wiki_page_versions_listing_type
|
||||
params.dig(:search, :wiki_page_id).present? ? :page : :global
|
||||
end
|
||||
|
||||
def wiki_page_version_status_diff(wiki_page_version)
|
||||
cur = wiki_page_version
|
||||
prev = wiki_page_version.previous
|
||||
|
||||
return "New" if prev.blank?
|
||||
|
||||
status = []
|
||||
status += ["Renamed"] if cur.title != prev.title
|
||||
status += ["Deleted"] if cur.is_deleted? && !prev.is_deleted?
|
||||
status += ["Undeleted"] if !cur.is_deleted? && prev.is_deleted?
|
||||
status.join(" ")
|
||||
end
|
||||
|
||||
def wiki_other_names_diff(new_version, old_version)
|
||||
new_names = new_version.other_names
|
||||
old_names = old_version.other_names
|
||||
@@ -23,9 +6,4 @@ module WikiPageVersionsHelper
|
||||
|
||||
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)
|
||||
pattern = Regexp.new('(?:<.+?>)|(?:\w+)|(?:[ \t]+)|(?:\r?\n)|(?:.+?)')
|
||||
DiffBuilder.new(thispage.body, otherpage.body, pattern).build
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user