- All text fields are now shown in their non-rendered form -- This allows changes to be highlighted with the diff builder -- The different fields were labeled and separated for easier discernment -- Fields are only shown if they have text in either the current or previous versions - Various changes are also verbalized for easier discovery - The date and the user columns were combined -- This is more in line with other indexes, plus it saves on space - The revert listing was changed to use a thumbnail instead of post ID links -- This makes it more in line with the post versions index
31 lines
833 B
Ruby
31 lines
833 B
Ruby
class ArtistCommentaryVersion < ApplicationRecord
|
|
belongs_to :post
|
|
belongs_to_updater
|
|
|
|
def self.search(params)
|
|
q = super
|
|
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
|