/wiki_page_versions: various usability improvements.

Changes to the /wiki_page_versions global listing:

* Add "diff" links that show you what changed in the given edit.
* Add "?" links that take you to the current version of the wiki.
* Add "»" links next to wiki page titles that take you to the wiki's full edit history.
* Add "»" links next to usernames that take you to the user's full edit history.
* Add a "Status" column that shows whether the wiki page was created,
  deleted, undeleted, or renamed.
* Link to /wiki_page_versions in sidebar, not /wiki_pages?order=time.
This commit is contained in:
evazion
2019-08-18 16:54:13 -05:00
parent 5b27726635
commit a586916cb3
6 changed files with 39 additions and 39 deletions

View File

@@ -1,4 +1,17 @@
module WikiPageVersionsHelper
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_page_diff(thispage, otherpage)
pattern = Regexp.new('(?:<.+?>)|(?:\w+)|(?:[ \t]+)|(?:\r?\n)|(?:.+?)')
other_names_pattern = Regexp.new('\S+|\s+')