Add alternate comparison types to versions
- The types are: -- Previous: The default and the previously used type -- Subsequent: Compares against the next version -- Current: Compares against the current version - Allow switching between comparison types in index and diff views -- Have links vary depending upon current comparison type
This commit is contained in:
@@ -39,6 +39,10 @@ class ApplicationController < ActionController::Base
|
|||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_version_comparison
|
||||||
|
params[:type] = %w[previous subsequent current].include?(params[:type]) ? params[:type] : "previous"
|
||||||
|
end
|
||||||
|
|
||||||
def model_name
|
def model_name
|
||||||
controller_name.classify
|
controller_name.classify
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ class ArtistCommentaryVersionsController < ApplicationController
|
|||||||
respond_to :html, :xml, :json
|
respond_to :html, :xml, :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
set_version_comparison
|
||||||
@commentary_versions = ArtistCommentaryVersion.paginated_search(params)
|
@commentary_versions = ArtistCommentaryVersion.paginated_search(params)
|
||||||
@commentary_versions = @commentary_versions.includes(:updater, post: :uploader) if request.format.html?
|
@commentary_versions = @commentary_versions.includes(:updater, post: :uploader) if request.format.html?
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ class ArtistVersionsController < ApplicationController
|
|||||||
respond_to :html, :xml, :json
|
respond_to :html, :xml, :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
set_version_comparison
|
||||||
@artist_versions = ArtistVersion.paginated_search(params)
|
@artist_versions = ArtistVersion.paginated_search(params)
|
||||||
@artist_versions = @artist_versions.includes(:updater, artist: :urls) if request.format.html?
|
@artist_versions = @artist_versions.includes(:updater, artist: :urls) if request.format.html?
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ class NoteVersionsController < ApplicationController
|
|||||||
respond_to :html, :xml, :json
|
respond_to :html, :xml, :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
set_version_comparison
|
||||||
@note_versions = NoteVersion.paginated_search(params)
|
@note_versions = NoteVersion.paginated_search(params)
|
||||||
@note_versions = @note_versions.includes(:updater) if request.format.html?
|
@note_versions = @note_versions.includes(:updater) if request.format.html?
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ class PoolVersionsController < ApplicationController
|
|||||||
around_action :set_timeout
|
around_action :set_timeout
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
set_version_comparison
|
||||||
@pool_versions = PoolVersion.paginated_search(params)
|
@pool_versions = PoolVersion.paginated_search(params)
|
||||||
@pool_versions = @pool_versions.includes(:updater, :pool) if request.format.html?
|
@pool_versions = @pool_versions.includes(:updater, :pool) if request.format.html?
|
||||||
|
|
||||||
@@ -19,7 +20,8 @@ class PoolVersionsController < ApplicationController
|
|||||||
if params[:other_id]
|
if params[:other_id]
|
||||||
@other_version = PoolVersion.find(params[:other_id])
|
@other_version = PoolVersion.find(params[:other_id])
|
||||||
else
|
else
|
||||||
@other_version = @pool_version.previous
|
set_version_comparison
|
||||||
|
@other_version = @pool_version.send(params[:type])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class PostVersionsController < ApplicationController
|
|||||||
respond_to :js, only: [:undo]
|
respond_to :js, only: [:undo]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
set_version_comparison
|
||||||
@post_versions = PostVersion.paginated_search(params)
|
@post_versions = PostVersion.paginated_search(params)
|
||||||
|
|
||||||
if request.format.html?
|
if request.format.html?
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class WikiPageVersionsController < ApplicationController
|
|||||||
layout "sidebar"
|
layout "sidebar"
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
set_version_comparison
|
||||||
@wiki_page_versions = WikiPageVersion.paginated_search(params)
|
@wiki_page_versions = WikiPageVersion.paginated_search(params)
|
||||||
@wiki_page_versions = @wiki_page_versions.includes(:updater) if request.format.html?
|
@wiki_page_versions = @wiki_page_versions.includes(:updater) if request.format.html?
|
||||||
|
|
||||||
@@ -16,15 +17,20 @@ class WikiPageVersionsController < ApplicationController
|
|||||||
|
|
||||||
def diff
|
def diff
|
||||||
if params[:thispage].blank? || params[:otherpage].blank?
|
if params[:thispage].blank? || params[:otherpage].blank?
|
||||||
redirect_back fallback_location: wiki_pages_path, notice: "You must select two versions to diff"
|
page_id = params[:thispage] || params[:otherpage]
|
||||||
return
|
if page_id.blank?
|
||||||
end
|
redirect_back fallback_location: wiki_pages_path, notice: "You must select at least one version to diff"
|
||||||
|
return
|
||||||
@thispage = WikiPageVersion.find(params[:thispage])
|
end
|
||||||
@otherpage = WikiPageVersion.find(params[:otherpage])
|
set_version_comparison
|
||||||
|
@thispage = WikiPageVersion.find(page_id)
|
||||||
if @thispage.id < @otherpage.id
|
@otherpage = @thispage.send(params[:type])
|
||||||
@thispage, @otherpage = @otherpage, @thispage
|
else
|
||||||
|
@thispage = WikiPageVersion.find(params[:thispage])
|
||||||
|
@otherpage = WikiPageVersion.find(params[:otherpage])
|
||||||
|
if @thispage.id < @otherpage.id
|
||||||
|
@thispage, @otherpage = @otherpage, @thispage
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_with([@thispage, @otherpage])
|
respond_with([@thispage, @otherpage])
|
||||||
|
|||||||
@@ -5,37 +5,45 @@ module ApplicationHelper
|
|||||||
(fields.reduce(false) { |acc, field| acc || params.dig(:search, field).present? } && (!member_check || CurrentUser.is_member?) ? types[0] : types[1])
|
(fields.reduce(false) { |acc, field| acc || params.dig(:search, field).present? } && (!member_check || CurrentUser.is_member?) ? types[0] : types[1])
|
||||||
end
|
end
|
||||||
|
|
||||||
def diff_list_html(new, old, latest, ul_class: ["diff-list"], li_class: [])
|
def diff_list_html(this_list, other_list, ul_class: ["diff-list"], li_class: [])
|
||||||
diff = SetDiff.new(new, old, latest)
|
diff = SetDiff.new(this_list, other_list)
|
||||||
render "diff_list", diff: diff, ul_class: ul_class, li_class: li_class
|
render "diff_list", diff: diff, ul_class: ul_class, li_class: li_class
|
||||||
end
|
end
|
||||||
|
|
||||||
def diff_name_html(this_name, prev_name)
|
def diff_name_html(this_name, other_name)
|
||||||
pattern = Regexp.new('.')
|
pattern = Regexp.new('.')
|
||||||
DiffBuilder.new(this_name, prev_name, pattern).build
|
DiffBuilder.new(this_name, other_name, pattern).build
|
||||||
end
|
end
|
||||||
|
|
||||||
def diff_body_html(record, previous, field)
|
def diff_body_html(record, other, field)
|
||||||
return h(record[field]).gsub(/\r?\n/, '<span class="paragraph-mark">¶</span><br>').html_safe if previous.blank?
|
if record.blank? || other.blank?
|
||||||
|
diff_record = other.presence || record
|
||||||
|
return h(diff_record[field]).gsub(/\r?\n/, '<span class="paragraph-mark">¶</span><br>').html_safe
|
||||||
|
end
|
||||||
|
|
||||||
pattern = Regexp.new('(?:<.+?>)|(?:\w+)|(?:[ \t]+)|(?:\r?\n)|(?:.+?)')
|
pattern = Regexp.new('(?:<.+?>)|(?:\w+)|(?:[ \t]+)|(?:\r?\n)|(?:.+?)')
|
||||||
DiffBuilder.new(record[field], previous[field], pattern).build
|
DiffBuilder.new(record[field], other[field], pattern).build
|
||||||
end
|
end
|
||||||
|
|
||||||
def status_diff_html(record)
|
def status_diff_html(record, type)
|
||||||
previous = record.previous
|
other = record.send(type)
|
||||||
|
|
||||||
return "New" if previous.blank?
|
if other.blank?
|
||||||
|
return type == "previous" ? "New" : ""
|
||||||
|
end
|
||||||
|
|
||||||
statuses = []
|
statuses = []
|
||||||
record.class.status_fields.each do |field, status|
|
record.class.status_fields.each do |field, status|
|
||||||
if record.has_attribute?(field)
|
if record.has_attribute?(field)
|
||||||
statuses += [status] if record[field] != previous[field]
|
statuses += [status] if record[field] != other[field]
|
||||||
else
|
else
|
||||||
statuses += [status] if record.send(field)
|
statuses += [status] if record.send(field, type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
statuses.join("<br>").html_safe
|
|
||||||
|
altered = record.updater_id != other.updater_id
|
||||||
|
|
||||||
|
%(<div class="version-statuses" data-altered="#{altered}">#{statuses.join("<br>")}</div>).html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def wordbreakify(string)
|
def wordbreakify(string)
|
||||||
@@ -44,6 +52,18 @@ module ApplicationHelper
|
|||||||
raw(wordbreaked_string)
|
raw(wordbreaked_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def version_type_links(params)
|
||||||
|
html = []
|
||||||
|
%w[previous subsequent current].each do |type|
|
||||||
|
if type == params[:type]
|
||||||
|
html << %(<span>#{type}</span>)
|
||||||
|
else
|
||||||
|
html << tag.li(link_to(type, params.except(:controller, :action).merge(type: type).permit!))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
html.join(" | ").html_safe
|
||||||
|
end
|
||||||
|
|
||||||
def nav_link_to(text, url, **options)
|
def nav_link_to(text, url, **options)
|
||||||
klass = options.delete(:class)
|
klass = options.delete(:class)
|
||||||
|
|
||||||
|
|||||||
10
app/helpers/artist_commentary_versions_helper.rb
Normal file
10
app/helpers/artist_commentary_versions_helper.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
module ArtistCommentaryVersionsHelper
|
||||||
|
def commentary_version_field_diff(commentary_version, type, field)
|
||||||
|
other = commentary_version.send(params[:type])
|
||||||
|
if type == "previous"
|
||||||
|
diff_body_html(commentary_version, other, field)
|
||||||
|
else
|
||||||
|
diff_body_html(other, commentary_version, field)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,34 +1,63 @@
|
|||||||
module ArtistVersionsHelper
|
module ArtistVersionsHelper
|
||||||
def artist_version_other_names_diff(artist_version)
|
def artist_version_other_names_diff(artist_version, type)
|
||||||
new_names = artist_version.other_names
|
other = artist_version.send(type)
|
||||||
old_names = artist_version.previous.try(:other_names)
|
this_names = artist_version.other_names
|
||||||
latest_names = artist_version.artist.other_names
|
if other.present?
|
||||||
|
other_names = other.other_names
|
||||||
|
elsif type == "subsequent"
|
||||||
|
other_names = this_names
|
||||||
|
else
|
||||||
|
other_names = []
|
||||||
|
end
|
||||||
|
|
||||||
diff_list_html(new_names, old_names, latest_names)
|
if type == "previous"
|
||||||
|
diff_list_html(this_names, other_names)
|
||||||
|
else
|
||||||
|
diff_list_html(other_names, this_names)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def artist_version_urls_diff(artist_version)
|
def artist_version_urls_diff(artist_version, type)
|
||||||
new_urls = artist_version.urls
|
other = artist_version.send(type)
|
||||||
old_urls = artist_version.previous.try(:urls)
|
this_urls = artist_version.urls
|
||||||
latest_urls = artist_version.artist.urls.map(&:to_s)
|
if other.present?
|
||||||
|
other_urls = other.urls
|
||||||
|
elsif type == "subsequent"
|
||||||
|
other_urls = this_urls
|
||||||
|
else
|
||||||
|
other_urls = []
|
||||||
|
end
|
||||||
|
|
||||||
diff_list_html(new_urls, old_urls, latest_urls)
|
if type == "previous"
|
||||||
|
diff_list_html(this_urls, other_urls)
|
||||||
|
else
|
||||||
|
diff_list_html(other_urls, this_urls)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def artist_version_name_diff(artist_version)
|
def artist_version_name_diff(artist_version, type)
|
||||||
previous = artist_version.previous
|
other = artist_version.send(type)
|
||||||
if previous.present? && (artist_version.name != previous.name)
|
if other.present? && (artist_version.name != other.name)
|
||||||
name_diff = diff_name_html(artist_version.name, previous.name)
|
if type == "previous"
|
||||||
|
name_diff = diff_name_html(artist_version.name, other.name)
|
||||||
|
else
|
||||||
|
name_diff = diff_name_html(other.name, artist_version.name)
|
||||||
|
end
|
||||||
%(<br><br><b>Rename:</b><br> #{name_diff}</p>).html_safe
|
%(<br><br><b>Rename:</b><br> #{name_diff}</p>).html_safe
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def artist_version_group_name_diff(artist_version)
|
def artist_version_group_name_diff(artist_version, type)
|
||||||
previous = artist_version.previous
|
other = artist_version.send(type)
|
||||||
if artist_version.group_name.present? || (previous.present? && previous.group_name.present?)
|
if artist_version.group_name.present? || (other.present? && other.group_name.present?)
|
||||||
group_name_diff = diff_name_html(artist_version.group_name, previous.group_name)
|
other_group_name = (other.present? ? other.group_name : artist_version.group_name)
|
||||||
|
if type == "previous"
|
||||||
|
group_name_diff = diff_name_html(artist_version.group_name, other_group_name)
|
||||||
|
else
|
||||||
|
group_name_diff = diff_name_html(other_group_name, artist_version.group_name)
|
||||||
|
end
|
||||||
%(<b>Group:</b><br> #{group_name_diff}<br><br>).html_safe
|
%(<b>Group:</b><br> #{group_name_diff}<br><br>).html_safe
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
|
|||||||
@@ -1,23 +1,36 @@
|
|||||||
module NoteVersionsHelper
|
module NoteVersionsHelper
|
||||||
def note_version_position_diff(note_version)
|
def note_version_position_diff(note_version, type)
|
||||||
previous = note_version.previous
|
other = note_version.send(type)
|
||||||
|
|
||||||
html = "#{note_version.x},#{note_version.y}"
|
html = "#{note_version.x},#{note_version.y}"
|
||||||
if previous.nil? || (note_version.x == previous.x && note_version.y == previous.y)
|
if other.nil? || (note_version.x == other.x && note_version.y == other.y)
|
||||||
html
|
html
|
||||||
|
elsif type == "previous"
|
||||||
|
"#{other.x},#{other.y} -> " + html
|
||||||
else
|
else
|
||||||
"#{previous.x},#{previous.y} -> " + html
|
html + " -> #{other.x},#{other.y}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def note_version_size_diff(note_version)
|
def note_version_size_diff(note_version, type)
|
||||||
previous = note_version.previous
|
other = note_version.send(type)
|
||||||
|
|
||||||
html = "#{note_version.width}x#{note_version.height}"
|
html = "#{note_version.width}x#{note_version.height}"
|
||||||
if previous.nil? || (note_version.width == previous.width && note_version.height == previous.height)
|
if other.nil? || (note_version.width == other.width && note_version.height == other.height)
|
||||||
html
|
html
|
||||||
|
elsif type == "previous"
|
||||||
|
"#{other.width}x#{other.height} -> " + html
|
||||||
else
|
else
|
||||||
"#{previous.width}x#{previous.height} -> " + html
|
html + " -> #{other.width}x#{other.height}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def note_version_body_diff(note_version, type)
|
||||||
|
other = note_version.send(params[:type])
|
||||||
|
if type == "previous"
|
||||||
|
diff_body_html(note_version, other, :body)
|
||||||
|
else
|
||||||
|
diff_body_html(other, note_version, :body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,29 +1,38 @@
|
|||||||
module PoolVersionsHelper
|
module PoolVersionsHelper
|
||||||
def pool_version_show_diff(pool_version)
|
def pool_version_show_diff(pool_version, type)
|
||||||
previous = pool_version.previous
|
other = pool_version.send(type)
|
||||||
previous.present? && pool_version.description != previous.description
|
other.present? && pool_version.description != other.description
|
||||||
end
|
end
|
||||||
|
|
||||||
def pool_version_name_diff(pool_version)
|
def pool_version_name_diff(pool_version, type)
|
||||||
previous = pool_version.previous
|
other = pool_version.send(type)
|
||||||
if previous.present? && (pool_version.name != previous.name)
|
if other.present? && (pool_version.name != other.name)
|
||||||
name_diff = diff_name_html(pool_version.pretty_name, previous.pretty_name)
|
if type == "previous"
|
||||||
|
name_diff = diff_name_html(pool_version.name, other.name)
|
||||||
|
else
|
||||||
|
name_diff = diff_name_html(other.name, pool_version.name)
|
||||||
|
end
|
||||||
%(<br><br><b>Rename:</b><br> #{name_diff}</p>).html_safe
|
%(<br><br><b>Rename:</b><br> #{name_diff}</p>).html_safe
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pool_version_post_diff(pool_version)
|
def pool_version_post_diff(pool_version, type)
|
||||||
previous = pool_version.previous
|
other = pool_version.send(type)
|
||||||
diff = {}
|
diff = {}
|
||||||
|
|
||||||
if previous.present?
|
if other.present? && type == "previous"
|
||||||
diff[:added_post_ids] = pool_version.post_ids - previous.post_ids
|
diff[:added_post_ids] = pool_version.post_ids - other.post_ids
|
||||||
diff[:removed_post_ids] = previous.post_ids - pool_version.post_ids
|
diff[:removed_post_ids] = other.post_ids - pool_version.post_ids
|
||||||
else
|
elsif other.present?
|
||||||
|
diff[:added_post_ids] = other.post_ids - pool_version.post_ids
|
||||||
|
diff[:removed_post_ids] = pool_version.post_ids - other.post_ids
|
||||||
|
elsif type == "previous"
|
||||||
diff[:added_post_ids] = pool_version.added_post_ids
|
diff[:added_post_ids] = pool_version.added_post_ids
|
||||||
diff[:removed_post_ids] = pool_version.removed_post_ids
|
diff[:removed_post_ids] = pool_version.removed_post_ids
|
||||||
|
else
|
||||||
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
render "pool_versions/diff", diff: diff
|
render "pool_versions/diff", diff: diff
|
||||||
|
|||||||
@@ -1,45 +1,38 @@
|
|||||||
module PostVersionsHelper
|
module PostVersionsHelper
|
||||||
def post_version_diff(post_version)
|
def post_version_diff(post_version, type)
|
||||||
previous = post_version.previous
|
other = post_version.send(type)
|
||||||
post = post_version.post
|
|
||||||
|
|
||||||
if post.nil?
|
this_tags = post_version.tag_array
|
||||||
latest_tags = post_version.tag_array
|
this_tags << "rating:#{post_version.rating}" if post_version.rating.present?
|
||||||
|
this_tags << "parent:#{post_version.parent_id}" if post_version.parent_id.present?
|
||||||
|
this_tags << "source:#{post_version.source}" if post_version.source.present?
|
||||||
|
|
||||||
|
other_tags = other.present? ? other.tag_array : []
|
||||||
|
if other.present?
|
||||||
|
other_tags << "rating:#{other.rating}" if other.rating.present?
|
||||||
|
other_tags << "parent:#{other.parent_id}" if other.parent_id.present?
|
||||||
|
other_tags << "source:#{other.source}" if other.source.present?
|
||||||
|
elsif type == "subsequent"
|
||||||
|
other_tags = this_tags
|
||||||
|
end
|
||||||
|
|
||||||
|
if type == "previous"
|
||||||
|
added_tags = this_tags - other_tags
|
||||||
|
removed_tags = other_tags - this_tags
|
||||||
else
|
else
|
||||||
latest_tags = post.tag_array
|
added_tags = other_tags - this_tags
|
||||||
latest_tags << "rating:#{post.rating}" if post.rating.present?
|
removed_tags = this_tags - other_tags
|
||||||
latest_tags << "parent:#{post.parent_id}" if post.parent_id.present?
|
|
||||||
latest_tags << "source:#{post.source}" if post.source.present?
|
|
||||||
end
|
end
|
||||||
|
unchanged_tags = this_tags & other_tags
|
||||||
new_tags = post_version.tag_array
|
|
||||||
new_tags << "rating:#{post_version.rating}" if post_version.rating.present?
|
|
||||||
new_tags << "parent:#{post_version.parent_id}" if post_version.parent_id.present?
|
|
||||||
new_tags << "source:#{post_version.source}" if post_version.source.present?
|
|
||||||
|
|
||||||
old_tags = previous.present? ? previous.tag_array : []
|
|
||||||
if previous.present?
|
|
||||||
old_tags << "rating:#{previous.rating}" if previous.rating.present?
|
|
||||||
old_tags << "parent:#{previous.parent_id}" if previous.parent_id.present?
|
|
||||||
old_tags << "source:#{previous.source}" if previous.source.present?
|
|
||||||
end
|
|
||||||
|
|
||||||
added_tags = new_tags - old_tags
|
|
||||||
removed_tags = old_tags - new_tags
|
|
||||||
obsolete_added_tags = added_tags - latest_tags,
|
|
||||||
obsolete_removed_tags = removed_tags & latest_tags,
|
|
||||||
unchanged_tags = new_tags & old_tags
|
|
||||||
|
|
||||||
html = '<span class="diff-list">'
|
html = '<span class="diff-list">'
|
||||||
|
|
||||||
added_tags.each do |tag|
|
added_tags.each do |tag|
|
||||||
prefix = obsolete_added_tags.include?(tag) ? '+<ins class="obsolete">' : '<ins>+'
|
html << '<ins>+' + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</ins>'
|
||||||
html << prefix + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</ins>'
|
|
||||||
html << " "
|
html << " "
|
||||||
end
|
end
|
||||||
removed_tags.each do |tag|
|
removed_tags.each do |tag|
|
||||||
prefix = obsolete_removed_tags.include?(tag) ? '-<del class="obsolete">' : '<del>-'
|
html << '<del>-' + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</del>'
|
||||||
html << prefix + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</del>'
|
|
||||||
html << " "
|
html << " "
|
||||||
end
|
end
|
||||||
unchanged_tags.each do |tag|
|
unchanged_tags.each do |tag|
|
||||||
|
|||||||
@@ -1,25 +1,28 @@
|
|||||||
module WikiPageVersionsHelper
|
module WikiPageVersionsHelper
|
||||||
def wiki_version_show_diff(wiki_page_version)
|
def wiki_version_show_diff(wiki_page_version, type)
|
||||||
previous = wiki_page_version.previous
|
other = wiki_page_version.send(type)
|
||||||
previous.present? && ((wiki_page_version.body != previous.body) || wiki_page_version.other_names_changed)
|
other.present? && ((wiki_page_version.body != other.body) || wiki_page_version.other_names_changed(type))
|
||||||
end
|
end
|
||||||
|
|
||||||
def wiki_version_show_other_names(new_version, old_version)
|
def wiki_version_show_other_names(this_version, other_version)
|
||||||
((new_version.other_names - old_version.other_names) | (old_version.other_names - new_version.other_names)).length > 0
|
((this_version.other_names - other_version.other_names) | (other_version.other_names - this_version.other_names)).length.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def wiki_version_other_names_diff(new_version, old_version)
|
def wiki_version_other_names_diff(this_version, other_version)
|
||||||
new_names = new_version.other_names
|
this_names = this_version.other_names
|
||||||
old_names = old_version.other_names
|
other_names = other_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"])
|
diff_list_html(this_names, other_names, ul_class: ["wiki-other-names-diff-list list-inline"], li_class: ["wiki-other-name"])
|
||||||
end
|
end
|
||||||
|
|
||||||
def wiki_version_title_diff(wiki_page_version)
|
def wiki_version_title_diff(wiki_page_version, type)
|
||||||
previous = wiki_page_version.previous
|
other = wiki_page_version.send(type)
|
||||||
if previous.present? && (wiki_page_version.title != previous.title)
|
if other.present? && (wiki_page_version.title != other.title)
|
||||||
name_diff = diff_name_html(wiki_page_version.title, previous.title)
|
if type == "previous"
|
||||||
|
name_diff = diff_name_html(wiki_page_version.title, other.title)
|
||||||
|
else
|
||||||
|
name_diff = diff_name_html(other.title, wiki_page_version.title)
|
||||||
|
end
|
||||||
%((<b>Rename:</b> #{name_diff})).html_safe
|
%((<b>Rename:</b> #{name_diff})).html_safe
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
|
|||||||
@@ -88,8 +88,6 @@
|
|||||||
|
|
||||||
--diff-list-added-color: green;
|
--diff-list-added-color: green;
|
||||||
--diff-list-removed-color: red;
|
--diff-list-removed-color: red;
|
||||||
--diff-list-obsolete-added-color: darkGreen;
|
|
||||||
--diff-list-obsolete-removed-color: darkRed;
|
|
||||||
|
|
||||||
--wiki-page-versions-diff-del-background: #FCC;
|
--wiki-page-versions-diff-del-background: #FCC;
|
||||||
--wiki-page-versions-diff-ins-background: #CFC;
|
--wiki-page-versions-diff-ins-background: #CFC;
|
||||||
@@ -301,8 +299,6 @@ body[data-current-user-theme="dark"] {
|
|||||||
|
|
||||||
--diff-list-added-color: var(--green-1);
|
--diff-list-added-color: var(--green-1);
|
||||||
--diff-list-removed-color: var(--red-1);
|
--diff-list-removed-color: var(--red-1);
|
||||||
--diff-list-obsolete-added-color: var(--green-3);
|
|
||||||
--diff-list-obsolete-removed-color: var(--red-3);
|
|
||||||
|
|
||||||
--dtext-blockquote-background: var(--grey-3);
|
--dtext-blockquote-background: var(--grey-3);
|
||||||
--dtext-blockquote-border: 1px solid var(--grey-4);
|
--dtext-blockquote-border: 1px solid var(--grey-4);
|
||||||
|
|||||||
@@ -5,20 +5,12 @@
|
|||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.added.obsolete, .added.obsolete a {
|
|
||||||
color: var(--diff-list-obsolete-added-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.removed, .removed a {
|
.removed, .removed a {
|
||||||
color: var(--diff-list-removed-color);
|
color: var(--diff-list-removed-color);
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.removed.obsolete, .removed.obsolete a {
|
|
||||||
color: var(--diff-list-obsolete-removed-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
ins, ins a {
|
ins, ins a {
|
||||||
color: var(--diff-list-added-color);
|
color: var(--diff-list-added-color);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@@ -30,14 +22,6 @@
|
|||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
ins.obsolete, ins.obsolete a {
|
|
||||||
color: var(--diff-list-obsolete-added-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
del.obsolete, del.obsolete a {
|
|
||||||
color: var(--diff-list-obsolete-removed-color);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.diff-body {
|
.diff-body {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ body.a-index {
|
|||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
table.striped {
|
table.striped {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,3 +11,15 @@ body.a-index {
|
|||||||
margin-top: 2em;
|
margin-top: 2em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div#version-comparisons {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul#version-comparisons-list, ul#version-comparisons-list li {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ div#c-wiki-page-versions {
|
|||||||
background: var(--wiki-page-versions-diff-ins-background);
|
background: var(--wiki-page-versions-diff-ins-background);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.wiki-other-names-diff-list li.obsolete {
|
|
||||||
text-decoration: dotted underline;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#a-index {
|
#a-index {
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
class SetDiff
|
class SetDiff
|
||||||
attr_reader :additions, :removals, :added, :removed, :obsolete_added, :obsolete_removed, :changed, :unchanged
|
attr_reader :additions, :removals, :added, :removed, :changed, :unchanged
|
||||||
|
|
||||||
def initialize(new, old, latest)
|
def initialize(this_list, other_list)
|
||||||
new, old, latest = new.to_a, old.to_a, latest.to_a
|
this, other = this_list.to_a, other_list.to_a
|
||||||
|
|
||||||
@additions = new - old
|
@additions = this - other
|
||||||
@removals = old - new
|
@removals = other - this
|
||||||
@unchanged = new & old
|
@unchanged = this & other
|
||||||
@obsolete_added = additions - latest
|
|
||||||
@obsolete_removed = removals & latest
|
|
||||||
@added, @removed, @changed = changes(additions, removals)
|
@added, @removed, @changed = changes(additions, removals)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,20 @@ class ArtistCommentaryVersion < ApplicationRecord
|
|||||||
@previous.first
|
@previous.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def subsequent
|
||||||
|
@subsequent ||= begin
|
||||||
|
ArtistCommentaryVersion.where("post_id = ? and updated_at > ?", post_id, updated_at).order("updated_at asc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@subsequent.first
|
||||||
|
end
|
||||||
|
|
||||||
|
def current
|
||||||
|
@current ||= begin
|
||||||
|
ArtistCommentaryVersion.where("post_id = ?", post_id).order("updated_at desc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@current.first
|
||||||
|
end
|
||||||
|
|
||||||
def self.status_fields
|
def self.status_fields
|
||||||
{
|
{
|
||||||
original_title: "OrigTitle",
|
original_title: "OrigTitle",
|
||||||
|
|||||||
@@ -30,6 +30,20 @@ class ArtistVersion < ApplicationRecord
|
|||||||
@previous.first
|
@previous.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def subsequent
|
||||||
|
@subsequent ||= begin
|
||||||
|
ArtistVersion.where("artist_id = ? and created_at > ?", artist_id, created_at).order("created_at asc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@subsequent.first
|
||||||
|
end
|
||||||
|
|
||||||
|
def current
|
||||||
|
@previous ||= begin
|
||||||
|
ArtistVersion.where("artist_id = ?", artist_id).order("created_at desc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@previous.first
|
||||||
|
end
|
||||||
|
|
||||||
def self.status_fields
|
def self.status_fields
|
||||||
{
|
{
|
||||||
name: "Renamed",
|
name: "Renamed",
|
||||||
@@ -43,28 +57,50 @@ class ArtistVersion < ApplicationRecord
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def other_names_changed
|
def other_names_changed(type)
|
||||||
((other_names - previous.other_names) | (previous.other_names - other_names)).length > 0
|
other = self.send(type)
|
||||||
|
((other_names - other.other_names) | (other.other_names - other_names)).length.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def urls_changed
|
def urls_changed(type)
|
||||||
((urls - previous.urls) | (previous.urls - urls)).length > 0
|
other = self.send(type)
|
||||||
|
((urls - other.urls) | (other.urls - urls)).length.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_deleted
|
def was_deleted(type)
|
||||||
is_deleted && !previous.is_deleted
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
is_deleted && !other.is_deleted
|
||||||
|
else
|
||||||
|
!is_deleted && other.is_deleted
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_undeleted
|
def was_undeleted(type)
|
||||||
!is_deleted && previous.is_deleted
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
!is_deleted && other.is_deleted
|
||||||
|
else
|
||||||
|
is_deleted && !other.is_deleted
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_banned
|
def was_banned(type)
|
||||||
is_banned && !previous.is_banned
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
is_banned && !other.is_banned
|
||||||
|
else
|
||||||
|
!is_banned && other.is_banned
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_unbanned
|
def was_unbanned(type)
|
||||||
!is_banned && previous.is_banned
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
!is_banned && other.is_banned
|
||||||
|
else
|
||||||
|
is_banned && !other.is_banned
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.available_includes
|
def self.available_includes
|
||||||
|
|||||||
@@ -14,11 +14,25 @@ class NoteVersion < ApplicationRecord
|
|||||||
|
|
||||||
def previous
|
def previous
|
||||||
@previous ||= begin
|
@previous ||= begin
|
||||||
NoteVersion.where("note_id = ? and updated_at < ?", note_id, updated_at).order("updated_at desc").limit(1).to_a
|
NoteVersion.where("note_id = ? and version < ?", note_id, version).order("updated_at desc").limit(1).to_a
|
||||||
end
|
end
|
||||||
@previous.first
|
@previous.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def subsequent
|
||||||
|
@subsequent ||= begin
|
||||||
|
NoteVersion.where("note_id = ? and version > ?", note_id, version).order("updated_at asc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@subsequent.first
|
||||||
|
end
|
||||||
|
|
||||||
|
def current
|
||||||
|
@current ||= begin
|
||||||
|
NoteVersion.where("note_id = ?", note_id).order("updated_at desc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@current.first
|
||||||
|
end
|
||||||
|
|
||||||
def self.status_fields
|
def self.status_fields
|
||||||
{
|
{
|
||||||
body: "Body",
|
body: "Body",
|
||||||
@@ -29,20 +43,32 @@ class NoteVersion < ApplicationRecord
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_moved
|
def was_moved(type)
|
||||||
x != previous.x || y != previous.y
|
other = self.send(type)
|
||||||
|
x != other.x || y != other.y
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_resized
|
def was_resized(type)
|
||||||
width != previous.width || height != previous.height
|
other = self.send(type)
|
||||||
|
width != other.width || height != other.height
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_deleted
|
def was_deleted(type)
|
||||||
!is_active && previous.is_active
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
!is_active && other.is_active
|
||||||
|
else
|
||||||
|
is_active && !other.is_active
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_undeleted
|
def was_undeleted(type)
|
||||||
is_active && !previous.is_active
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
is_active && !other.is_active
|
||||||
|
else
|
||||||
|
!is_active && other.is_active
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.available_includes
|
def self.available_includes
|
||||||
|
|||||||
@@ -96,6 +96,20 @@ class PoolVersion < ApplicationRecord
|
|||||||
@previous.first
|
@previous.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def subsequent
|
||||||
|
@subsequent ||= begin
|
||||||
|
PoolVersion.where("pool_id = ? and version > ?", pool_id, version).order("version asc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@subsequent.first
|
||||||
|
end
|
||||||
|
|
||||||
|
def current
|
||||||
|
@current ||= begin
|
||||||
|
PoolVersion.where("pool_id = ?", pool_id).order("version desc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@current.first
|
||||||
|
end
|
||||||
|
|
||||||
def self.status_fields
|
def self.status_fields
|
||||||
{
|
{
|
||||||
posts_changed: "Posts",
|
posts_changed: "Posts",
|
||||||
@@ -108,24 +122,45 @@ class PoolVersion < ApplicationRecord
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def posts_changed
|
def posts_changed(type)
|
||||||
((post_ids - previous.post_ids) | (previous.post_ids - post_ids)).length > 0
|
other = self.send(type)
|
||||||
|
((post_ids - other.post_ids) | (other.post_ids - post_ids)).length.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_deleted
|
def was_deleted(type)
|
||||||
is_deleted && !previous.is_deleted
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
is_deleted && !other.is_deleted
|
||||||
|
else
|
||||||
|
!is_deleted && other.is_deleted
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_undeleted
|
def was_undeleted(type)
|
||||||
!is_deleted && previous.is_deleted
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
!is_deleted && other.is_deleted
|
||||||
|
else
|
||||||
|
is_deleted && !other.is_deleted
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_activated
|
def was_activated(type)
|
||||||
is_active && !previous.is_active
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
is_active && !other.is_active
|
||||||
|
else
|
||||||
|
!is_active && other.is_active
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_deactivated
|
def was_deactivated(type)
|
||||||
!is_active && previous.is_active
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
!is_active && other.is_active
|
||||||
|
else
|
||||||
|
is_active && !other.is_active
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pretty_name
|
def pretty_name
|
||||||
|
|||||||
@@ -99,6 +99,20 @@ class PostVersion < ApplicationRecord
|
|||||||
@previous.first
|
@previous.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def subsequent
|
||||||
|
@subsequent ||= begin
|
||||||
|
PostVersion.where("post_id = ? and version > ?", post_id, version).order("version asc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@subsequent.first
|
||||||
|
end
|
||||||
|
|
||||||
|
def current
|
||||||
|
@current ||= begin
|
||||||
|
PostVersion.where("post_id = ?", post_id).order("version desc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@current.first
|
||||||
|
end
|
||||||
|
|
||||||
def visible?
|
def visible?
|
||||||
post&.visible?
|
post&.visible?
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -30,6 +30,20 @@ class WikiPageVersion < ApplicationRecord
|
|||||||
@previous.first
|
@previous.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def subsequent
|
||||||
|
@subsequent ||= begin
|
||||||
|
WikiPageVersion.where("wiki_page_id = ? and id > ?", wiki_page_id, id).order("id asc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@subsequent.first
|
||||||
|
end
|
||||||
|
|
||||||
|
def current
|
||||||
|
@current ||= begin
|
||||||
|
WikiPageVersion.where("wiki_page_id = ?", wiki_page_id).order("id desc").limit(1).to_a
|
||||||
|
end
|
||||||
|
@current.first
|
||||||
|
end
|
||||||
|
|
||||||
def self.status_fields
|
def self.status_fields
|
||||||
{
|
{
|
||||||
body: "Body",
|
body: "Body",
|
||||||
@@ -40,16 +54,27 @@ class WikiPageVersion < ApplicationRecord
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def other_names_changed
|
def other_names_changed(type)
|
||||||
((other_names - previous.other_names) | (previous.other_names - other_names)).length > 0
|
other = self.send(type)
|
||||||
|
((other_names - other.other_names) | (other.other_names - other_names)).length.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_deleted
|
def was_deleted(type)
|
||||||
is_deleted && !previous.is_deleted
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
is_deleted && !other.is_deleted
|
||||||
|
else
|
||||||
|
!is_deleted && other.is_deleted
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def was_undeleted
|
def was_undeleted(type)
|
||||||
!is_deleted && previous.is_deleted
|
other = self.send(type)
|
||||||
|
if type == "previous"
|
||||||
|
!is_deleted && other.is_deleted
|
||||||
|
else
|
||||||
|
is_deleted && !other.is_deleted
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.available_includes
|
def self.available_includes
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
<%= tag.ul class: [*ul_class] do %>
|
<%= tag.ul class: [*ul_class] do %>
|
||||||
<% diff.added.each do |item| %>
|
<% diff.added.each do |item| %>
|
||||||
<%= tag.li item, class: ["added", ("obsolete" if item.in?(diff.obsolete_added)), *li_class] %>
|
<%= tag.li item, class: ["added", *li_class] %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% diff.removed.each do |item| %>
|
<% diff.removed.each do |item| %>
|
||||||
<%= tag.li item, class: ["removed", ("obsolete" if item.in?(diff.obsolete_removed)), *li_class] %>
|
<%= tag.li item, class: ["removed", *li_class] %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% diff.changed.each do |old, new| %>
|
<% diff.changed.each do |old, new| %>
|
||||||
|
|||||||
@@ -19,13 +19,13 @@
|
|||||||
<% if !commentary_version.unchanged_empty?(:original_title) %>
|
<% if !commentary_version.unchanged_empty?(:original_title) %>
|
||||||
<b>Title:</b>
|
<b>Title:</b>
|
||||||
<div class="commentary-body-section">
|
<div class="commentary-body-section">
|
||||||
<%= diff_body_html(commentary_version, commentary_version.previous, :original_title) %>
|
<%= commentary_version_field_diff(commentary_version, params[:type], :original_title) %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if !commentary_version.unchanged_empty?(:original_description) %>
|
<% if !commentary_version.unchanged_empty?(:original_description) %>
|
||||||
<b>Description:</b>
|
<b>Description:</b>
|
||||||
<div class="commentary-body-section">
|
<div class="commentary-body-section">
|
||||||
<%= diff_body_html(commentary_version, commentary_version.previous, :original_description) %>
|
<%= commentary_version_field_diff(commentary_version, params[:type], :original_description) %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -33,18 +33,18 @@
|
|||||||
<% if !commentary_version.unchanged_empty?(:translated_title) %>
|
<% if !commentary_version.unchanged_empty?(:translated_title) %>
|
||||||
<b>Title:</b>
|
<b>Title:</b>
|
||||||
<div class="commentary-body-section">
|
<div class="commentary-body-section">
|
||||||
<%= diff_body_html(commentary_version, commentary_version.previous, :translated_title) %>
|
<%= commentary_version_field_diff(commentary_version, params[:type], :translated_title) %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if !commentary_version.unchanged_empty?(:translated_description) %>
|
<% if !commentary_version.unchanged_empty?(:translated_description) %>
|
||||||
<b>Description:</b>
|
<b>Description:</b>
|
||||||
<div class="commentary-body-section">
|
<div class="commentary-body-section">
|
||||||
<%= diff_body_html(commentary_version, commentary_version.previous, :translated_description) %>
|
<%= commentary_version_field_diff(commentary_version, params[:type], :translated_description) %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Changes", width: "3%" do |commentary_version| %>
|
<% t.column "Changes", width: "3%" do |commentary_version| %>
|
||||||
<%= status_diff_html(commentary_version) %>
|
<%= status_diff_html(commentary_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Updated", width: "10%" do |commentary_version| %>
|
<% t.column "Updated", width: "10%" do |commentary_version| %>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<div id="a-index">
|
<div id="a-index">
|
||||||
<h1>Artist Commentary History</h1>
|
<h1>Artist Commentary History</h1>
|
||||||
|
|
||||||
|
<%= render "versions/types" %>
|
||||||
|
|
||||||
<%= render "posts/partials/common/inline_blacklist" %>
|
<%= render "posts/partials/common/inline_blacklist" %>
|
||||||
|
|
||||||
<%= render "listing" %>
|
<%= render "listing" %>
|
||||||
|
|||||||
@@ -4,17 +4,17 @@
|
|||||||
<% t.column "Name", td: {class: "diff-body"} do |artist_version| %>
|
<% t.column "Name", td: {class: "diff-body"} do |artist_version| %>
|
||||||
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
|
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
|
||||||
<%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}, anchor: "artist-version-#{artist_version.id}") %>
|
<%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}, anchor: "artist-version-#{artist_version.id}") %>
|
||||||
<%= artist_version_name_diff(artist_version) %>
|
<%= artist_version_name_diff(artist_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Other Names", td: {class: "diff-body"} do |artist_version| %>
|
<% t.column "Other Names", td: {class: "diff-body"} do |artist_version| %>
|
||||||
<%= artist_version_group_name_diff(artist_version) %>
|
<%= artist_version_group_name_diff(artist_version, params[:type]) %>
|
||||||
<%= artist_version_other_names_diff(artist_version) %>
|
<%= artist_version_other_names_diff(artist_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "URLs", td: {class: "col-expand"} do |artist_version| %>
|
<% t.column "URLs", td: {class: "col-expand"} do |artist_version| %>
|
||||||
<%= artist_version_urls_diff(artist_version) %>
|
<%= artist_version_urls_diff(artist_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Changes" do |artist_version| %>
|
<% t.column "Changes" do |artist_version| %>
|
||||||
<%= status_diff_html(artist_version) %>
|
<%= status_diff_html(artist_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Updated" do |artist_version| %>
|
<% t.column "Updated" do |artist_version| %>
|
||||||
<%= link_to_user artist_version.updater %>
|
<%= link_to_user artist_version.updater %>
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<div id="a-index">
|
<div id="a-index">
|
||||||
<h1>Artist History</h1>
|
<h1>Artist History</h1>
|
||||||
|
|
||||||
|
<%= render "versions/types" %>
|
||||||
|
|
||||||
<%= render "listing" %>
|
<%= render "listing" %>
|
||||||
|
|
||||||
<%= numbered_paginator(@artist_versions, :search_count => params[:search]) %>
|
<%= numbered_paginator(@artist_versions, :search_count => params[:search]) %>
|
||||||
|
|||||||
@@ -14,16 +14,16 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Body", td: {class: "col-expand diff-body"} do |note_version| %>
|
<% t.column "Body", td: {class: "col-expand diff-body"} do |note_version| %>
|
||||||
<%= diff_body_html(note_version, note_version.previous, :body) %>
|
<%= note_version_body_diff(note_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Position (X,Y)", width: "5%", column: "position" do |note_version| %>
|
<% t.column "Position (X,Y)", width: "5%", column: "position" do |note_version| %>
|
||||||
<%= note_version_position_diff(note_version) %>
|
<%= note_version_position_diff(note_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Size (WxH)", width: "5%", column: "size" do |note_version| %>
|
<% t.column "Size (WxH)", width: "5%", column: "size" do |note_version| %>
|
||||||
<%= note_version_size_diff(note_version) %>
|
<%= note_version_size_diff(note_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Changes", width: "3%" do |note_version| %>
|
<% t.column "Changes", width: "3%" do |note_version| %>
|
||||||
<%= status_diff_html(note_version) %>
|
<%= status_diff_html(note_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Updated", width: "10%" do |note_version| %>
|
<% t.column "Updated", width: "10%" do |note_version| %>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<div id="a-index">
|
<div id="a-index">
|
||||||
<h1>Note History</h1>
|
<h1>Note History</h1>
|
||||||
|
|
||||||
|
<%= render "versions/types" %>
|
||||||
|
|
||||||
<%= render "listing" %>
|
<%= render "listing" %>
|
||||||
|
|
||||||
<%= numbered_paginator(@note_versions) %>
|
<%= numbered_paginator(@note_versions) %>
|
||||||
|
|||||||
@@ -2,21 +2,21 @@
|
|||||||
|
|
||||||
<%= table_for @pool_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
<%= table_for @pool_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
||||||
<% t.column column: "diff", width: "3%" do |pool_version| %>
|
<% t.column column: "diff", width: "3%" do |pool_version| %>
|
||||||
<%= link_to_if pool_version_show_diff(pool_version), "diff", diff_pool_version_path(pool_version.id) %>
|
<%= link_to_if pool_version_show_diff(pool_version, params[:type]), "diff", diff_pool_version_path(pool_version.id) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Pool", td: {class: "diff-body"} do |pool_version| %>
|
<% t.column "Pool", td: {class: "diff-body"} do |pool_version| %>
|
||||||
<%= link_to pool_version.pretty_name, pool_path(pool_version.pool_id), class: "pool-category-#{pool_version.pool.category}" %>
|
<%= link_to pool_version.pretty_name, pool_path(pool_version.pool_id), class: "pool-category-#{pool_version.pool.category}" %>
|
||||||
<%= link_to "»", pool_versions_path(search: { pool_id: pool_version.pool_id }, anchor: "pool-version-#{pool_version.id}"), class: "pool-category-#{pool_version.pool.category}" %>
|
<%= link_to "»", pool_versions_path(search: { pool_id: pool_version.pool_id }, anchor: "pool-version-#{pool_version.id}"), class: "pool-category-#{pool_version.pool.category}" %>
|
||||||
<%= pool_version_name_diff(pool_version) %>
|
<%= pool_version_name_diff(pool_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Post Changes", td: { class: "col-expand" } do |pool_version| %>
|
<% t.column "Post Changes", td: { class: "col-expand" } do |pool_version| %>
|
||||||
<%= pool_version_post_diff(pool_version) %>
|
<%= pool_version_post_diff(pool_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Post Count" do |pool_version| %>
|
<% t.column "Post Count" do |pool_version| %>
|
||||||
<%= link_to pool_version.post_ids.size, pool_versions_path(search: { pool_id: pool_version.pool_id }) %>
|
<%= link_to pool_version.post_ids.size, pool_versions_path(search: { pool_id: pool_version.pool_id }) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Changes", td: {class: "col-expand"} do |pool_version| %>
|
<% t.column "Changes", td: {class: "col-expand"} do |pool_version| %>
|
||||||
<%= status_diff_html(pool_version) %>
|
<%= status_diff_html(pool_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Updated", width: "10%" do |pool_version| %>
|
<% t.column "Updated", width: "10%" do |pool_version| %>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -3,18 +3,26 @@
|
|||||||
|
|
||||||
<div id="c-pool-versions">
|
<div id="c-pool-versions">
|
||||||
<div id="a-diff">
|
<div id="a-diff">
|
||||||
<h1>Pool Version Comparison: <%= link_to @pool_version.pretty_name, pool_versions_path(search: { pool_id: @pool_version.pool_id }, anchor: "pool-version-#{@pool_version.id}"), class: "pool-category-#{@pool_version.pool.category}" %></h1>
|
<h1>Pool Version Comparison: <%= link_to @pool_version.pretty_name, pool_versions_path(search: { pool_id: @pool_version.pool_id }, type: params[:type], anchor: "pool-version-#{@pool_version.id}"), class: "pool-category-#{@pool_version.pool.category}" %></h1>
|
||||||
|
|
||||||
|
<%= render "versions/types" %>
|
||||||
|
|
||||||
<% if @other_version.present? %>
|
<% if @other_version.present? %>
|
||||||
<p>Showing differences between <%= compact_time @pool_version.updated_at %> (<%= link_to_user @pool_version.updater %>) and <%= compact_time @other_version.updated_at %> (<%= link_to_user @other_version.updater %>)</p>
|
<% if @pool_version.id != @other_version.id %>
|
||||||
|
<p>Showing differences between <%= compact_time @pool_version.updated_at %> (<%= link_to_user @pool_version.updater %>) and <%= compact_time @other_version.updated_at %> (<%= link_to_user @other_version.updater %>)</p>
|
||||||
|
|
||||||
<% if @pool_version.description != @other_version.description %>
|
<% if @pool_version.description != @other_version.description %>
|
||||||
<div class="diff-body">
|
<div class="diff-body">
|
||||||
<%= diff_body_html(@pool_version, @other_version, :description) %>
|
<%= diff_body_html(@pool_version, @other_version, :description) %>
|
||||||
</div>
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<p><em>No changes to description.</em></p>
|
||||||
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p><em>No changes to description.</em></p>
|
<p><em>Version is latest!</em></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<p><em>No versions to compare!</em></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<div id="a-index">
|
<div id="a-index">
|
||||||
<h1>Pool History</h1>
|
<h1>Pool History</h1>
|
||||||
|
|
||||||
|
<%= render "versions/types" %>
|
||||||
|
|
||||||
<%= render "listing" %>
|
<%= render "listing" %>
|
||||||
|
|
||||||
<%= numbered_paginator(@pool_versions) %>
|
<%= numbered_paginator(@pool_versions) %>
|
||||||
|
|||||||
@@ -18,10 +18,10 @@
|
|||||||
<%= link_to "#{post_version.post_id}.#{post_version.version}", post_versions_path(search: { post_id: post_version.post_id }, anchor: "post-version-#{post_version.id}") %>
|
<%= link_to "#{post_version.post_id}.#{post_version.version}", post_versions_path(search: { post_id: post_version.post_id }, anchor: "post-version-#{post_version.id}") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Tags", td: {class: "col-expand"} do |post_version| %>
|
<% t.column "Tags", td: {class: "col-expand"} do |post_version| %>
|
||||||
<%= post_version_diff(post_version) %>
|
<%= post_version_diff(post_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Changes" do |post_version| %>
|
<% t.column "Changes" do |post_version| %>
|
||||||
<%= status_diff_html(post_version) %>
|
<%= status_diff_html(post_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Updated" do |post_version| %>
|
<% t.column "Updated" do |post_version| %>
|
||||||
<%= link_to_user post_version.updater %>
|
<%= link_to_user post_version.updater %>
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
<h1>Post History</h1>
|
<h1>Post History</h1>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= render "versions/types" %>
|
||||||
|
|
||||||
<%= search_form_for(post_versions_path, classes: "inline-form") do |f| %>
|
<%= search_form_for(post_versions_path, classes: "inline-form") do |f| %>
|
||||||
<%= f.input :post_id, label: "Post", input_html: { value: params.dig(:search, :post_id) } %>
|
<%= f.input :post_id, label: "Post", input_html: { value: params.dig(:search, :post_id) } %>
|
||||||
<%= f.input :updater_name, label: "Updater", input_html: { "data-autocomplete": "user", value: params.dig(:search, :updater_name) } %>
|
<%= f.input :updater_name, label: "Updater", input_html: { "data-autocomplete": "user", value: params.dig(:search, :updater_name) } %>
|
||||||
|
|||||||
6
app/views/versions/_types.html.erb
Normal file
6
app/views/versions/_types.html.erb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<div id="version-comparisons">
|
||||||
|
<span>Version comparison:</span>
|
||||||
|
<ul id="version-comparisons-list">
|
||||||
|
<%= version_type_links(params) %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<%= form_tag(diff_wiki_page_versions_path, :method => :get) do %>
|
<%= form_tag(diff_wiki_page_versions_path, :method => :get) do %>
|
||||||
<%= table_for @wiki_page_versions.includes(:updater, :tag), width: "100%" do |t| %>
|
<%= table_for @wiki_page_versions.includes(:updater, :tag), width: "100%" do |t| %>
|
||||||
<% t.column column: "diff", width: "3%" do |wiki_page_version, i| %>
|
<% t.column column: "diff", width: "3%" do |wiki_page_version, i| %>
|
||||||
<%= link_to_if wiki_version_show_diff(wiki_page_version), "diff", diff_wiki_page_versions_path(otherpage: wiki_page_version.previous.try(:id), thispage: wiki_page_version.id) %>
|
<%= link_to_if wiki_version_show_diff(wiki_page_version, params[:type]), "diff", diff_wiki_page_versions_path(thispage: wiki_page_version.id, type: params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if listing_type(:wiki_page_id, member_check: false, types: [:page, :global]) == :page %>
|
<% if listing_type(:wiki_page_id, member_check: false, types: [:page, :global]) == :page %>
|
||||||
@@ -20,10 +20,10 @@
|
|||||||
<%= link_to wiki_page_version.title, wiki_page_version %>
|
<%= link_to wiki_page_version.title, wiki_page_version %>
|
||||||
<%= link_to "»", wiki_page_versions_path(search: { wiki_page_id: wiki_page_version.wiki_page_id }) %>
|
<%= link_to "»", wiki_page_versions_path(search: { wiki_page_id: wiki_page_version.wiki_page_id }) %>
|
||||||
</span>
|
</span>
|
||||||
<%= wiki_version_title_diff(wiki_page_version) %>
|
<%= wiki_version_title_diff(wiki_page_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Changes", width: "5%" do |wiki_page_version| %>
|
<% t.column "Changes", width: "5%" do |wiki_page_version| %>
|
||||||
<%= status_diff_html(wiki_page_version) %>
|
<%= status_diff_html(wiki_page_version, params[:type]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Updated", width: "26%" do |wiki_page_version| %>
|
<% t.column "Updated", width: "26%" do |wiki_page_version| %>
|
||||||
<%= compact_time(wiki_page_version.updated_at) %>
|
<%= compact_time(wiki_page_version.updated_at) %>
|
||||||
|
|||||||
@@ -4,21 +4,33 @@
|
|||||||
<%= render "wiki_pages/sidebar" %>
|
<%= render "wiki_pages/sidebar" %>
|
||||||
|
|
||||||
<% content_for(:content) do %>
|
<% content_for(:content) do %>
|
||||||
<h1>Wiki Page Version Comparison: <%= link_to @thispage.title, wiki_page_versions_path(search: { wiki_page_id: @thispage.wiki_page_id }, anchor: "wiki-page-version-#{@thispage.id}"), class: "tag-type-#{@thispage.wiki_page.category_name}" %></h1>
|
<h1>Wiki Page Version Comparison: <%= link_to @thispage.title, wiki_page_versions_path(search: { wiki_page_id: @thispage.wiki_page_id }, type: params[:type], anchor: "wiki-page-version-#{@thispage.id}"), class: "tag-type-#{@thispage.wiki_page.category_name}" %></h1>
|
||||||
|
|
||||||
<p>Showing differences between <%= compact_time @thispage.updated_at %> (<%= link_to_user @thispage.updater %>) and <%= compact_time @otherpage.updated_at %> (<%= link_to_user @otherpage.updater %>)</p>
|
<% if params[:type].present? %>
|
||||||
|
<%= render "versions/types" %>
|
||||||
<% if wiki_version_show_other_names(@thispage, @otherpage) %>
|
|
||||||
<p><%= wiki_version_other_names_diff(@thispage, @otherpage) %></p>
|
|
||||||
<% else %>
|
|
||||||
<p><em>No changes to other names.</em></p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @thispage.body != @otherpage.body %>
|
<% if @otherpage.present? %>
|
||||||
<div class="diff-body">
|
<% if @thispage.id != @otherpage.id %>
|
||||||
<%= diff_body_html(@thispage, @otherpage, :body) %>
|
<p>Showing differences between <%= compact_time @thispage.updated_at %> (<%= link_to_user @thispage.updater %>) and <%= compact_time @otherpage.updated_at %> (<%= link_to_user @otherpage.updater %>)</p>
|
||||||
</div>
|
|
||||||
|
<% if wiki_version_show_other_names(@thispage, @otherpage) %>
|
||||||
|
<p><%= wiki_version_other_names_diff(@thispage, @otherpage) %></p>
|
||||||
|
<% else %>
|
||||||
|
<p><em>No changes to other names.</em></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if @thispage.body != @otherpage.body %>
|
||||||
|
<div class="diff-body">
|
||||||
|
<%= diff_body_html(@thispage, @otherpage, :body) %>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<p><em>No changes to body.</em></p>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<p><em>Version is latest!</em></p>
|
||||||
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p><em>No changes to body.</em></p>
|
<p><em>No versions to compare!</em></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
<% content_for(:content) do %>
|
<% content_for(:content) do %>
|
||||||
<h1>Wiki Page History</h1>
|
<h1>Wiki Page History</h1>
|
||||||
|
|
||||||
|
<%= render "versions/types" %>
|
||||||
|
|
||||||
<%= render "listing" %>
|
<%= render "listing" %>
|
||||||
|
|
||||||
<%= numbered_paginator(@wiki_page_versions) %>
|
<%= numbered_paginator(@wiki_page_versions) %>
|
||||||
|
|||||||
Reference in New Issue
Block a user