Merge pull request #4291 from BrokenEagle/rework-version-views
Rework version views
This commit is contained in:
@@ -1,11 +1,38 @@
|
||||
require 'dtext'
|
||||
|
||||
module ApplicationHelper
|
||||
def listing_type(*fields, member_check: true, types: [:revert, :standard])
|
||||
(fields.reduce(false) { |acc, field| acc || params.dig(:search, field).present? } && (!member_check || CurrentUser.is_member?) ? types[0] : types[1])
|
||||
end
|
||||
|
||||
def diff_list_html(new, old, latest, ul_class: ["diff-list"], li_class: [])
|
||||
diff = SetDiff.new(new, old, latest)
|
||||
render "diff_list", diff: diff, ul_class: ul_class, li_class: li_class
|
||||
end
|
||||
|
||||
def diff_body_html(record, previous, field)
|
||||
return h(record[field]).gsub(/\r?\n/, '<span class="paragraph-mark">¶</span><br>').html_safe if previous.blank?
|
||||
|
||||
pattern = Regexp.new('(?:<.+?>)|(?:\w+)|(?:[ \t]+)|(?:\r?\n)|(?:.+?)')
|
||||
DiffBuilder.new(record[field], previous[field], pattern).build
|
||||
end
|
||||
|
||||
def status_diff_html(record)
|
||||
previous = record.previous
|
||||
|
||||
return "New" if previous.blank?
|
||||
|
||||
statuses = []
|
||||
record.class.status_fields.each do |field, status|
|
||||
if record.has_attribute?(field)
|
||||
statuses += [status] if record[field] != previous[field]
|
||||
else
|
||||
statuses += [status] if record.send(field)
|
||||
end
|
||||
end
|
||||
statuses.join("<br>").html_safe
|
||||
end
|
||||
|
||||
def wordbreakify(string)
|
||||
lines = string.scan(/.{1,10}/)
|
||||
wordbreaked_string = lines.map {|str| h(str)}.join("<wbr>")
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
module ArtistCommentaryVersionsHelper
|
||||
def artist_commentary_versions_listing_type
|
||||
params.dig(:search, :post_id).present? ? :revert : :standard
|
||||
end
|
||||
end
|
||||
@@ -1,8 +1,4 @@
|
||||
module ArtistVersionsHelper
|
||||
def artist_versions_listing_type
|
||||
(params.dig(:search, :artist_id).present? && CurrentUser.is_member?) ? :revert : :standard
|
||||
end
|
||||
|
||||
def artist_version_other_names_diff(artist_version)
|
||||
new_names = artist_version.other_names
|
||||
old_names = artist_version.previous.try(:other_names)
|
||||
|
||||
@@ -1,34 +1,23 @@
|
||||
module NoteVersionsHelper
|
||||
def note_versions_listing_type
|
||||
((params.dig(:search, :post_id).present? || params.dig(:search, :note_id).present?) && CurrentUser.is_member?) ? :revert : :standard
|
||||
end
|
||||
|
||||
def note_version_body_diff_info(note_version)
|
||||
previous = note_version.previous
|
||||
if previous.nil?
|
||||
return ""
|
||||
end
|
||||
|
||||
html = ""
|
||||
if note_version.body == previous.body
|
||||
html += '<span class="inactive">(body not changed)</span>'
|
||||
end
|
||||
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
def note_version_position_diff(note_version)
|
||||
previous = note_version.previous
|
||||
|
||||
html = "#{note_version.width}x#{note_version.height}"
|
||||
html += " #{note_version.x},#{note_version.y}"
|
||||
html = "#{note_version.x},#{note_version.y}"
|
||||
if previous.nil?
|
||||
html
|
||||
elsif note_version.x == previous.x && note_version.y == previous.y && note_version.width == previous.width && note_version.height == previous.height
|
||||
else
|
||||
"#{previous.x},#{previous.y} -> " + html
|
||||
end
|
||||
end
|
||||
|
||||
def note_version_size_diff(note_version)
|
||||
previous = note_version.previous
|
||||
|
||||
html = "#{note_version.width}x#{note_version.height}"
|
||||
if previous.nil?
|
||||
html
|
||||
else
|
||||
html = '<span style="text-decoration: underline;">' + html + '</span>'
|
||||
html.html_safe
|
||||
"#{previous.width}x#{previous.height} -> " + html
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
module PoolVersionsHelper
|
||||
def pool_versions_listing_type
|
||||
params.dig(:search, :pool_id).present? ? :revert : :standard
|
||||
end
|
||||
|
||||
def pool_version_status_diff(pool_version)
|
||||
cur = pool_version
|
||||
prev = pool_version.previous
|
||||
|
||||
return "New" if prev.blank?
|
||||
|
||||
status = []
|
||||
status += ["Renamed"] if cur.name != prev.name
|
||||
status += ["DescChanged"] if cur.description != prev.description
|
||||
status += ["Deleted"] if cur.is_deleted? && !prev.is_deleted?
|
||||
status += ["Undeleted"] if !cur.is_deleted? && prev.is_deleted?
|
||||
status += ["Activated"] if cur.is_active? && !prev.is_active?
|
||||
status += ["Deactivated"] if !cur.is_active? && prev.is_active?
|
||||
status.join(" ")
|
||||
end
|
||||
|
||||
def pool_page_diff(pool_version, other_version)
|
||||
pattern = Regexp.new('(?:<.+?>)|(?:\w+)|(?:[ \t]+)|(?:\r?\n)|(?:.+?)')
|
||||
DiffBuilder.new(pool_version.description, other_version.description, pattern).build
|
||||
end
|
||||
end
|
||||
@@ -1,8 +1,4 @@
|
||||
module PostVersionsHelper
|
||||
def post_versions_listing_type
|
||||
params.dig(:search, :post_id).present? ? :revert : :standard
|
||||
end
|
||||
|
||||
def post_version_diff(post_version)
|
||||
diff = post_version.diff(post_version.previous)
|
||||
html = '<span class="diff-list">'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -39,3 +39,19 @@
|
||||
color: var(--diff-list-obsolete-removed-color);
|
||||
}
|
||||
}
|
||||
|
||||
.diff-body {
|
||||
del {
|
||||
background: var(--wiki-page-versions-diff-del-background);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
ins {
|
||||
background: var(--wiki-page-versions-diff-ins-background);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
span.paragraph-mark {
|
||||
opacity: 0.25;
|
||||
}
|
||||
}
|
||||
|
||||
13
app/javascript/src/styles/common/versions.scss
Normal file
13
app/javascript/src/styles/common/versions.scss
Normal file
@@ -0,0 +1,13 @@
|
||||
body.a-index {
|
||||
div#p-revert-listing {
|
||||
display: flex;
|
||||
|
||||
table.striped {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
div#p-revert-listing > article.post-preview {
|
||||
margin-top: 2em;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
div#c-artist-commentary-versions {
|
||||
#a-index {
|
||||
div.commentary-body-section {
|
||||
padding: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
border: var(--footer-border);
|
||||
}
|
||||
|
||||
td.original-column,
|
||||
td.translated-column {
|
||||
padding-top: 0.5em;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
div#c-pool-versions {
|
||||
#a-diff {
|
||||
del {
|
||||
background: var(--wiki-page-versions-diff-del-background);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
ins {
|
||||
background: var(--wiki-page-versions-diff-ins-background);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
span.paragraph-mark {
|
||||
opacity: 0.25;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,4 @@ body.c-post-versions.a-index {
|
||||
.advanced-search-link {
|
||||
margin: 0 1em;
|
||||
}
|
||||
|
||||
#p-revert-listing {
|
||||
display: flex;
|
||||
table#post-versions-table { flex: 1; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
div#c-wiki-page-versions {
|
||||
#a-diff {
|
||||
del, .wiki-other-names-diff-list .removed {
|
||||
ul.wiki-other-names-diff-list li.removed {
|
||||
background: var(--wiki-page-versions-diff-del-background);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
ins, .wiki-other-names-diff-list .added {
|
||||
ul.wiki-other-names-diff-list li.added {
|
||||
background: var(--wiki-page-versions-diff-ins-background);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.wiki-other-names-diff-list .obsolete {
|
||||
ul.wiki-other-names-diff-list li.obsolete {
|
||||
text-decoration: dotted underline;
|
||||
}
|
||||
|
||||
span.paragraph-mark {
|
||||
opacity: 0.25;
|
||||
}
|
||||
}
|
||||
|
||||
#a-index {
|
||||
|
||||
@@ -20,6 +20,14 @@ class DiffBuilder
|
||||
output.each { |q| q.replace(escape_html[q]) }
|
||||
|
||||
diffs.reverse_each do |hunk|
|
||||
old_cr = hunk[0].try(:old_element)
|
||||
new_cr = hunk[1].try(:new_element)
|
||||
if old_cr && new_cr && old_cr.match?(/^\r?\n$/) && new_cr.match?(/^\r?\n$/)
|
||||
hunk_position = hunk[0].old_position
|
||||
output[hunk_position] = '<del><span class="paragraph-mark">¶</span></del><ins><span class="paragraph-mark">¶</span></ins><br>'
|
||||
next
|
||||
end
|
||||
|
||||
newchange = hunk.max {|a, b| a.old_position <=> b.old_position}
|
||||
newstart = newchange.old_position
|
||||
oldstart = hunk.min {|a, b| a.old_position <=> b.old_position}.old_position
|
||||
|
||||
@@ -7,4 +7,24 @@ class ArtistCommentaryVersion < ApplicationRecord
|
||||
q = q.search_attributes(params, :post, :updater, :original_title, :original_description, :translated_title, :translated_description)
|
||||
q.apply_default_order(params)
|
||||
end
|
||||
|
||||
def previous
|
||||
@previous ||= begin
|
||||
ArtistCommentaryVersion.where("post_id = ? and updated_at < ?", post_id, updated_at).order("updated_at desc").limit(1).to_a
|
||||
end
|
||||
@previous.first
|
||||
end
|
||||
|
||||
def self.status_fields
|
||||
{
|
||||
original_title: "OrigTitle",
|
||||
original_description: "OrigDesc",
|
||||
translated_title: "TransTitle",
|
||||
translated_description: "TransDesc",
|
||||
}
|
||||
end
|
||||
|
||||
def unchanged_empty?(field)
|
||||
self[field].strip.empty? && (previous.nil? || previous[field].strip.empty?)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,6 +24,46 @@ class ArtistVersion < ApplicationRecord
|
||||
extend SearchMethods
|
||||
|
||||
def previous
|
||||
ArtistVersion.where("artist_id = ? and created_at < ?", artist_id, created_at).order("created_at desc").first
|
||||
@previous ||= begin
|
||||
ArtistVersion.where("artist_id = ? and created_at < ?", artist_id, created_at).order("created_at desc").limit(1).to_a
|
||||
end
|
||||
@previous.first
|
||||
end
|
||||
|
||||
def self.status_fields
|
||||
{
|
||||
name: "Renamed",
|
||||
urls_changed: "URLs",
|
||||
other_names_changed: "OtherNames",
|
||||
group_name: "GroupName",
|
||||
was_deleted: "Deleted",
|
||||
was_undeleted: "Undeleted",
|
||||
was_banned: "Banned",
|
||||
was_unbanned: "Unbanned",
|
||||
}
|
||||
end
|
||||
|
||||
def other_names_changed
|
||||
((other_names - previous.other_names) | (previous.other_names - other_names)).length > 0
|
||||
end
|
||||
|
||||
def urls_changed
|
||||
((urls - previous.urls) | (previous.urls - urls)).length > 0
|
||||
end
|
||||
|
||||
def was_deleted
|
||||
!is_active && previous.is_active
|
||||
end
|
||||
|
||||
def was_undeleted
|
||||
is_active && !previous.is_active
|
||||
end
|
||||
|
||||
def was_banned
|
||||
is_banned && !previous.is_banned
|
||||
end
|
||||
|
||||
def was_unbanned
|
||||
!is_banned && previous.is_banned
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,6 +13,35 @@ class NoteVersion < ApplicationRecord
|
||||
end
|
||||
|
||||
def previous
|
||||
NoteVersion.where("note_id = ? and updated_at < ?", note_id, updated_at).order("updated_at desc").first
|
||||
@previous ||= begin
|
||||
NoteVersion.where("note_id = ? and updated_at < ?", note_id, updated_at).order("updated_at desc").limit(1).to_a
|
||||
end
|
||||
@previous.first
|
||||
end
|
||||
|
||||
def self.status_fields
|
||||
{
|
||||
body: "Body",
|
||||
was_moved: "Moved",
|
||||
was_resized: "Resized",
|
||||
was_deleted: "Deleted",
|
||||
was_undeleted: "Undeleted",
|
||||
}
|
||||
end
|
||||
|
||||
def was_moved
|
||||
x != previous.x || y != previous.y
|
||||
end
|
||||
|
||||
def was_resized
|
||||
width != previous.width || height != previous.height
|
||||
end
|
||||
|
||||
def was_deleted
|
||||
!is_active && previous.is_active
|
||||
end
|
||||
|
||||
def was_undeleted
|
||||
is_active && !previous.is_active
|
||||
end
|
||||
end
|
||||
|
||||
@@ -108,7 +108,41 @@ class PoolArchive < ApplicationRecord
|
||||
end
|
||||
|
||||
def previous
|
||||
PoolArchive.where("pool_id = ? and version < ?", pool_id, version).order("version desc").first
|
||||
@previous ||= begin
|
||||
PoolArchive.where("pool_id = ? and version < ?", pool_id, version).order("version desc").limit(1).to_a
|
||||
end
|
||||
@previous.first
|
||||
end
|
||||
|
||||
def self.status_fields
|
||||
{
|
||||
name: "Renamed",
|
||||
description: "Description",
|
||||
was_deleted: "Deleted",
|
||||
was_undeleted: "Undeleted",
|
||||
was_activated: "Activated",
|
||||
was_deactivated: "Deactivated",
|
||||
}
|
||||
end
|
||||
|
||||
def was_deleted
|
||||
is_deleted && !previous.is_deleted
|
||||
end
|
||||
|
||||
def was_undeleted
|
||||
!is_deleted && previous.is_deleted
|
||||
end
|
||||
|
||||
def was_activated
|
||||
is_active && !previous.is_active
|
||||
end
|
||||
|
||||
def was_deactivated
|
||||
!is_active && previous.is_active
|
||||
end
|
||||
|
||||
def text_field_changed
|
||||
previous.present? && (name_changed || description_changed)
|
||||
end
|
||||
|
||||
def pretty_name
|
||||
|
||||
@@ -92,19 +92,31 @@ class PostArchive < ApplicationRecord
|
||||
end
|
||||
|
||||
def previous
|
||||
# HACK: if all the post versions for this post have already been preloaded,
|
||||
# we can use that to avoid a SQL query.
|
||||
if association(:post).loaded? && post && post.association(:versions).loaded?
|
||||
post.versions.sort_by(&:version).reverse.find { |v| v.version < version }
|
||||
else
|
||||
PostArchive.where("post_id = ? and version < ?", post_id, version).order("version desc").first
|
||||
@previous ||= begin
|
||||
# HACK: if all the post versions for this post have already been preloaded,
|
||||
# we can use that to avoid a SQL query.
|
||||
if association(:post).loaded? && post && post.association(:versions).loaded?
|
||||
ver = [post.versions.sort_by(&:version).reverse.find { |v| v.version < version }]
|
||||
else
|
||||
ver = PostArchive.where("post_id = ? and version < ?", post_id, version).order("version desc").limit(1).to_a
|
||||
end
|
||||
end
|
||||
@previous.first
|
||||
end
|
||||
|
||||
def visible?
|
||||
post&.visible?
|
||||
end
|
||||
|
||||
def self.status_fields
|
||||
{
|
||||
tags: "Tags",
|
||||
rating: "Rating",
|
||||
parent_id: "Parent",
|
||||
source: "Source",
|
||||
}
|
||||
end
|
||||
|
||||
def diff(version = nil)
|
||||
if post.nil?
|
||||
latest_tags = tag_array
|
||||
|
||||
@@ -23,7 +23,32 @@ class WikiPageVersion < ApplicationRecord
|
||||
end
|
||||
|
||||
def previous
|
||||
WikiPageVersion.where("wiki_page_id = ? and id < ?", wiki_page_id, id).order("id desc").first
|
||||
@previous ||= begin
|
||||
WikiPageVersion.where("wiki_page_id = ? and id < ?", wiki_page_id, id).order("id desc").limit(1).to_a
|
||||
end
|
||||
@previous.first
|
||||
end
|
||||
|
||||
def self.status_fields
|
||||
{
|
||||
body: "Body",
|
||||
other_names_changed: "OtherNames",
|
||||
title: "Renamed",
|
||||
was_deleted: "Deleted",
|
||||
was_undeleted: "Undeleted",
|
||||
}
|
||||
end
|
||||
|
||||
def other_names_changed
|
||||
((other_names - previous.other_names) | (previous.other_names - other_names)).length > 0
|
||||
end
|
||||
|
||||
def was_deleted
|
||||
is_deleted && !previous.is_deleted
|
||||
end
|
||||
|
||||
def was_undeleted
|
||||
!is_deleted && previous.is_deleted
|
||||
end
|
||||
|
||||
def category_name
|
||||
|
||||
@@ -1,33 +1,60 @@
|
||||
<div id="p-<%= artist_commentary_versions_listing_type %>-listing">
|
||||
<div id="p-<%= listing_type(:post_id) %>-listing">
|
||||
|
||||
<%= table_for @commentary_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<% t.column "Post", width: "5%" do |commentary_version| %>
|
||||
<% if artist_commentary_versions_listing_type == :revert %>
|
||||
<%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %>
|
||||
<% else %>
|
||||
<%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %>
|
||||
<% if listing_type(:post_id) == :revert %>
|
||||
<%= PostPresenter.preview(@commentary_versions.first.post, show_deleted: true) %>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @commentary_versions, {class: "striped", width: "100%"} do |t| %>
|
||||
<% if listing_type(:post_id) == :standard %>
|
||||
<% t.column "Post", width: "1%" do |commentary_version| %>
|
||||
<%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if artist_commentary_versions_listing_type == :standard %>
|
||||
<% t.column "Version" do |commentary_version| %>
|
||||
<%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}) %>
|
||||
<% if listing_type(:post_id) == :standard %>
|
||||
<% t.column "Version", width: "3%" do |commentary_version| %>
|
||||
<%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}, anchor: "artist-commentary-version-#{commentary_version.id}") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Original" do |commentary_version| %>
|
||||
<%= format_commentary_title(commentary_version.original_title) %>
|
||||
<%= format_commentary_description(commentary_version.original_description) %>
|
||||
<% t.column "Original", width: "40%", td: {class: "diff-body"} do |commentary_version| %>
|
||||
<% if !commentary_version.unchanged_empty?(:original_title) %>
|
||||
<b>Title:</b>
|
||||
<div class="commentary-body-section">
|
||||
<%= diff_body_html(commentary_version, commentary_version.previous, :original_title) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if !commentary_version.unchanged_empty?(:original_description) %>
|
||||
<b>Description:</b>
|
||||
<div class="commentary-body-section">
|
||||
<%= diff_body_html(commentary_version, commentary_version.previous, :original_description) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Translated" do |commentary_version| %>
|
||||
<%= format_commentary_title(commentary_version.translated_title) %>
|
||||
<%= format_commentary_description(commentary_version.translated_description) %>
|
||||
<% t.column "Translated", width: "40%", td: {class: "diff-body"} do |commentary_version| %>
|
||||
<% if !commentary_version.unchanged_empty?(:translated_title) %>
|
||||
<b>Title:</b>
|
||||
<div class="commentary-body-section">
|
||||
<%= diff_body_html(commentary_version, commentary_version.previous, :translated_title) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if !commentary_version.unchanged_empty?(:translated_description) %>
|
||||
<b>Description:</b>
|
||||
<div class="commentary-body-section">
|
||||
<%= diff_body_html(commentary_version, commentary_version.previous, :translated_description) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Edited by", width: "10%" do |commentary_version| %>
|
||||
<% t.column "Changes", width: "3%" do |commentary_version| %>
|
||||
<%= status_diff_html(commentary_version) %>
|
||||
<% end %>
|
||||
<% t.column "Updated", width: "10%" do |commentary_version| %>
|
||||
<div>
|
||||
<%= compact_time commentary_version.updated_at %>
|
||||
</div>
|
||||
by
|
||||
<%= link_to_user commentary_version.updater %>
|
||||
<%= link_to "»", artist_commentary_versions_path(search: params[:search].merge({ updater_id: commentary_version.updater_id })) %>
|
||||
<% end %>
|
||||
<% t.column "Date", width: "10%" do |commentary_version| %>
|
||||
<%= compact_time commentary_version.updated_at %>
|
||||
<% end %>
|
||||
<% if artist_commentary_versions_listing_type == :revert %>
|
||||
<% if listing_type(:post_id) == :revert %>
|
||||
<% t.column column: "control", width: "7%" do |commentary_version| %>
|
||||
<%= link_to "Revert to", revert_artist_commentary_path(commentary_version.post_id, :version_id => commentary_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
<div id="p-<%= artist_versions_listing_type %>-listing">
|
||||
<div id="p-<%= listing_type(:artist_id) %>-listing">
|
||||
|
||||
<%= table_for @artist_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<% t.column "Name" do |artist_version| %>
|
||||
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
|
||||
<%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}) %>
|
||||
|
||||
<% if !artist_version.is_active? %>
|
||||
(deleted)
|
||||
<% end %>
|
||||
|
||||
<% if artist_version.group_name.present? %>
|
||||
<p>(group: <%= artist_version.group_name %>)</p>
|
||||
<% end %>
|
||||
<%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}, anchor: "artist-version-#{artist_version.id}") %>
|
||||
<% end %>
|
||||
<% t.column "Other Names" do |artist_version| %>
|
||||
<% if artist_version.group_name.present? %>
|
||||
<p><b>Group:</b><br> <%= artist_version.group_name %></p>
|
||||
<% end %>
|
||||
<%= artist_version_other_names_diff(artist_version) %>
|
||||
<% end %>
|
||||
<% t.column "URLs", td: {class: "col-expand"} do |artist_version| %>
|
||||
<%= artist_version_urls_diff(artist_version) %>
|
||||
<% end %>
|
||||
<% t.column "Changes" do |artist_version| %>
|
||||
<%= status_diff_html(artist_version) %>
|
||||
<% end %>
|
||||
<% t.column "Updated" do |artist_version| %>
|
||||
<%= link_to_user artist_version.updater %>
|
||||
<%= link_to "»", artist_versions_path(search: { updater_name: artist_version.updater.name }) %>
|
||||
@@ -26,7 +24,7 @@
|
||||
<%= compact_time(artist_version.updated_at) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% if artist_versions_listing_type == :revert %>
|
||||
<% if listing_type(:artist_id) == :revert %>
|
||||
<% t.column column: "control" do |artist_version| %>
|
||||
<%= link_to "Revert to", revert_artist_path(artist_version.artist_id, version_id: artist_version.id), method: :put, "data-confirm": "Are you sure you want to revert to this version?" %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,35 +1,39 @@
|
||||
<div id="p-<%= note_versions_listing_type %>-listing">
|
||||
<div id="p-<%= listing_type(:post_id, :note_id) %>-listing">
|
||||
|
||||
<%= table_for @note_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<% t.column "Post", width: "5%" do |note_version| %>
|
||||
<%= link_to note_version.post_id, post_path(note_version.post_id) %>
|
||||
<% if !params.dig(:search, :post_id).present? %>
|
||||
<%= link_to "»", note_versions_path(search: {post_id: note_version.post_id}) %>
|
||||
<%= link_to "»", note_versions_path(search: {post_id: note_version.post_id}, anchor: "note-version-#{note_version.id}") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Note", width: "5%" do |note_version| %>
|
||||
<%= link_to "#{note_version.note_id}.#{note_version.version}", post_path(note_version.post_id, anchor: "note-#{note_version.note_id}") %>
|
||||
<% if !params.dig(:search, :note_id).present? %>
|
||||
<%= link_to "»", note_versions_path(search: {note_id: note_version.note_id}) %>
|
||||
<%= link_to "»", note_versions_path(search: {note_id: note_version.note_id}, anchor: "note-version-#{note_version.id}") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Body", td: {class: "col-expand"} do |note_version| %>
|
||||
<%= h(note_version.body) %>
|
||||
<% unless note_version.is_active? %>
|
||||
<span class="inactive">(deleted)</span>
|
||||
<% end %>
|
||||
<%= note_version_body_diff_info(note_version) %>
|
||||
<% t.column "Body", td: {class: "col-expand diff-body"} do |note_version| %>
|
||||
<%= diff_body_html(note_version, note_version.previous, :body) %>
|
||||
<% end %>
|
||||
<% t.column "Position", width: "5%" do |note_version| %>
|
||||
<% t.column "Position (X,Y)", width: "5%", column: "position" do |note_version| %>
|
||||
<%= note_version_position_diff(note_version) %>
|
||||
<% end %>
|
||||
<% t.column "Edited By", width: "10%" do |note_version| %>
|
||||
<% t.column "Size (WxH)", width: "5%", column: "size" do |note_version| %>
|
||||
<%= note_version_size_diff(note_version) %>
|
||||
<% end %>
|
||||
<% t.column "Changes", width: "3%" do |note_version| %>
|
||||
<%= status_diff_html(note_version) %>
|
||||
<% end %>
|
||||
<% t.column "Updated", width: "10%" do |note_version| %>
|
||||
<div>
|
||||
<%= compact_time note_version.updated_at %>
|
||||
</div>
|
||||
by
|
||||
<%= link_to_user note_version.updater %>
|
||||
<%= link_to "»", note_versions_path(search: params[:search].merge({ updater_id: note_version.updater_id })) %>
|
||||
<% end %>
|
||||
<% t.column "Date", width: "10%" do |note_version| %>
|
||||
<%= compact_time note_version.updated_at %>
|
||||
<% end %>
|
||||
<% if note_versions_listing_type == :revert %>
|
||||
<% if listing_type(:post_id, :note_id) == :revert %>
|
||||
<% t.column column: "control", width: "7%" do |note_version| %>
|
||||
<%= link_to "Revert to", revert_note_path(note_version.note_id, :version_id => note_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
|
||||
<% end %>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<% diff[:removed_post_ids].each do |post_id| %>
|
||||
<del>
|
||||
<%= link_to post_id, post_path(post_id) %><%#
|
||||
%><%= link_to "»", pool_versions_path(search: { post_id: post_id }) %>
|
||||
</del>
|
||||
%><%= link_to "»", pool_versions_path(search: { post_id: post_id }) %><%#
|
||||
%></del>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<div id="p-<%= pool_versions_listing_type %>-listing">
|
||||
<div id="p-<%= listing_type(:pool_id) %>-listing">
|
||||
|
||||
<%= table_for @pool_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<% t.column column: "diff", width: "3%" do |pool_version| %>
|
||||
<%= link_to_if pool_version.previous.present?, "diff", diff_pool_version_path(pool_version.id) %>
|
||||
<%= link_to_if pool_version.text_field_changed, "diff", diff_pool_version_path(pool_version.id) %>
|
||||
<% end %>
|
||||
<% t.column "Pool" 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_versions_path(search: { pool_id: 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-archive-#{pool_version.id}"), class: "pool-category-#{pool_version.pool.category}" %>
|
||||
<% end %>
|
||||
<% t.column "Post Changes", td: { class: "col-expand" } do |pool_version| %>
|
||||
<%= render "pool_versions/diff", diff: pool_version.build_diff %>
|
||||
@@ -14,19 +14,18 @@
|
||||
<% t.column "Post Count" do |pool_version| %>
|
||||
<%= link_to pool_version.post_ids.size, pool_versions_path(search: { pool_id: pool_version.pool_id }) %>
|
||||
<% end %>
|
||||
<% t.column "Status", td: {class: "col-expand"} do |pool_version| %>
|
||||
<%= pool_version_status_diff(pool_version) %>
|
||||
<% t.column "Changes", td: {class: "col-expand"} do |pool_version| %>
|
||||
<%= status_diff_html(pool_version) %>
|
||||
<% end %>
|
||||
<% t.column "Updater" do |pool_version| %>
|
||||
<% if pool_version.updater %>
|
||||
<%= link_to_user pool_version.updater %>
|
||||
<%= link_to "»", pool_versions_path(search: { updater_id: pool_version.updater_id }) %>
|
||||
<% end %>
|
||||
<% t.column "Updated", width: "10%" do |pool_version| %>
|
||||
<div>
|
||||
<%= compact_time pool_version.updated_at %>
|
||||
</div>
|
||||
by
|
||||
<%= link_to_user pool_version.updater %>
|
||||
<%= link_to "»", pool_versions_path(search: params[:search].merge({ updater_id: pool_version.updater_id })) %>
|
||||
<% end %>
|
||||
<% t.column "Date" do |pool_version| %>
|
||||
<%= compact_time pool_version.updated_at %>
|
||||
<% end %>
|
||||
<% if pool_versions_listing_type == :revert %>
|
||||
<% if listing_type(:pool_id) == :revert %>
|
||||
<% t.column column: "control" do |pool_version| %>
|
||||
<%= link_to "Revert to", revert_pool_path(pool_version.pool_id, :version_id => pool_version.id), :method => :put, :remote => true %>
|
||||
<% end %>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<% 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>
|
||||
<div>
|
||||
<div class="diff-body">
|
||||
<h2>Name:</h2>
|
||||
<p>
|
||||
<% if @pool_version.name != @other_version.name %>
|
||||
@@ -21,11 +21,11 @@
|
||||
<h2>Posts:</h2>
|
||||
<p><%= render "pool_versions/diff", diff: @pool_version.build_diff(@other_version) %></p>
|
||||
</div>
|
||||
<div>
|
||||
<div class="diff-body">
|
||||
<h2>Description:</h2>
|
||||
<p>
|
||||
<% if @pool_version.description != @other_version.description %>
|
||||
<%= pool_page_diff(@pool_version, @other_version) %>
|
||||
<%= diff_body_html(@pool_version, @other_version, :description) %>
|
||||
<% else %>
|
||||
<i>Unchanged.</i>
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div id="p-<%= post_versions_listing_type %>-listing">
|
||||
<% if post_versions_listing_type == :revert %>
|
||||
<div id="p-<%= listing_type(:post_id) %>-listing">
|
||||
<% if listing_type(:post_id) == :revert %>
|
||||
<%= PostPresenter.preview(@post_versions.first.post, show_deleted: true) %>
|
||||
<% end %>
|
||||
|
||||
@@ -9,17 +9,20 @@
|
||||
<input type="checkbox" class="post-version-select-checkbox" <%= "disabled" unless post_version.can_undo?(CurrentUser.user) %>>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if post_versions_listing_type == :standard %>
|
||||
<% if listing_type(:post_id) == :standard %>
|
||||
<% t.column "Post" do |post_version| %>
|
||||
<%= PostPresenter.preview(post_version.post, show_deleted: true) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Version" do |post_version| %>
|
||||
<%= 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-archive-#{post_version.id}") %>
|
||||
<% end %>
|
||||
<% t.column "Tags", td: {class: "col-expand"} do |post_version| %>
|
||||
<%= post_version_diff(post_version) %>
|
||||
<% end %>
|
||||
<% t.column "Changes" do |post_version| %>
|
||||
<%= status_diff_html(post_version) %>
|
||||
<% end %>
|
||||
<% t.column "Updated" do |post_version| %>
|
||||
<%= link_to_user post_version.updater %>
|
||||
<%= link_to "»", post_versions_path(search: params[:search].merge({ updater_name: post_version.updater&.name })) %>
|
||||
@@ -31,7 +34,7 @@
|
||||
<% if post_version.can_undo?(CurrentUser.user) %>
|
||||
<%= link_to "Undo", undo_post_version_path(post_version), method: :put, remote: true, class: "post-version-undo-link" %>
|
||||
<% end %>
|
||||
<% if post_versions_listing_type == :revert && post_version.can_revert_to?(CurrentUser.user) %>
|
||||
<% if listing_type(:post_id) == :revert && post_version.can_revert_to?(CurrentUser.user) %>
|
||||
| <%= link_to "Revert to", revert_post_path(post_version.post_id, version_id: post_version.id), method: :put, remote: true %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="c-post-versions">
|
||||
<div id="a-index">
|
||||
<% if post_versions_listing_type == :revert && @post_versions.present? %>
|
||||
<% if listing_type(:post_id) == :revert && @post_versions.present? %>
|
||||
<h1>Tag History: <%= link_to "Post ##{params.dig(:search, :post_id)}", @post_versions[0].post %></h1>
|
||||
<% else %>
|
||||
<h1>Tag History</h1>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<div id="p-<%= wiki_page_versions_listing_type %>-listing">
|
||||
<div id="p-<%= listing_type(:wiki_page_id, member_check: false, types: [:page, :global]) %>-listing">
|
||||
<%= form_tag(diff_wiki_page_versions_path, :method => :get) do %>
|
||||
<%= table_for @wiki_page_versions, width: "100%" do |t| %>
|
||||
<% t.column column: "diff", width: "3%" do |wiki_page_version, i| %>
|
||||
<%= link_to_if wiki_page_version.previous.present?, "diff", diff_wiki_page_versions_path(otherpage: wiki_page_version.previous.try(:id), thispage: wiki_page_version.id) %>
|
||||
<% end %>
|
||||
|
||||
<% if wiki_page_versions_listing_type == :page %>
|
||||
<% if listing_type(:wiki_page_id, member_check: false, types: [:page, :global]) == :page %>
|
||||
<% t.column column: "this-page", width: "2%" do |wiki_page_version, i| %>
|
||||
<%= radio_button_tag "thispage", wiki_page_version.id, (i == 1) %>
|
||||
<% end %>
|
||||
@@ -21,10 +21,10 @@
|
||||
<%= link_to "»", wiki_page_versions_path(search: { wiki_page_id: wiki_page_version.wiki_page_id }) %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% t.column "Status", width: "5%" do |wiki_page_version| %>
|
||||
<%= wiki_page_version_status_diff(wiki_page_version) %>
|
||||
<% t.column "Changes", width: "5%" do |wiki_page_version| %>
|
||||
<%= status_diff_html(wiki_page_version) %>
|
||||
<% end %>
|
||||
<% t.column "Last edited", width: "26%" do |wiki_page_version| %>
|
||||
<% t.column "Updated", width: "26%" do |wiki_page_version| %>
|
||||
<%= compact_time(wiki_page_version.updated_at) %>
|
||||
by
|
||||
<%= link_to_user wiki_page_version.updater %>
|
||||
@@ -32,7 +32,7 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if wiki_page_versions_listing_type == :page %>
|
||||
<% if listing_type(:wiki_page_id, member_check: false, types: [:page, :global]) == :page %>
|
||||
<%= submit_tag "Diff" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
<%= wiki_other_names_diff(@thispage, @otherpage) %>
|
||||
|
||||
<div>
|
||||
<%= wiki_body_diff(@thispage, @otherpage) %>
|
||||
<div class="diff-body">
|
||||
<%= diff_body_html(@thispage, @otherpage, :body) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user