Merge pull request #4242 from BrokenEagle/add-api-data

Add API data to show/index views
This commit is contained in:
evazion
2020-01-05 16:34:29 -06:00
committed by GitHub
120 changed files with 1453 additions and 1709 deletions

View File

@@ -43,7 +43,7 @@ class ArtistsController < ApplicationController
end
def show
@artist = Artist.find(params[:id])
@current_item = @artist = Artist.find(params[:id])
@post_set = PostSets::Artist.new(@artist)
respond_with(@artist)
end

View File

@@ -19,7 +19,7 @@ class BansController < ApplicationController
end
def show
@ban = Ban.find(params[:id])
@current_item = @ban = Ban.find(params[:id])
respond_with(@ban)
end

View File

@@ -15,7 +15,7 @@ class BulkUpdateRequestsController < ApplicationController
end
def show
@bulk_update_request = BulkUpdateRequest.find(params[:id])
@current_item = @bulk_update_request = BulkUpdateRequest.find(params[:id])
respond_with(@bulk_update_request)
end

View File

@@ -24,7 +24,7 @@ class DmailsController < ApplicationController
end
def show
@dmail = Dmail.find(params[:id])
@current_item = @dmail = Dmail.find(params[:id])
check_privilege(@dmail)
@dmail.mark_as_read!
respond_with(@dmail)

View File

@@ -8,7 +8,7 @@ class FavoriteGroupsController < ApplicationController
end
def show
@favorite_group = FavoriteGroup.find(params[:id])
@current_item = @favorite_group = FavoriteGroup.find(params[:id])
check_read_privilege(@favorite_group)
@post_set = PostSets::FavoriteGroup.new(@favorite_group, params[:page])
respond_with(@favorite_group)

View File

@@ -24,7 +24,7 @@ class ForumTopicsController < ApplicationController
params[:search][:order] ||= "sticky" if request.format == Mime::Type.lookup("text/html")
params[:limit] ||= 40
@forum_topics = ForumTopic.active.paginated_search(params)
@forum_topics = ForumTopic.paginated_search(params)
@forum_topics = @forum_topics.includes(:creator, :updater).load if request.format.html?
@forum_topics = @forum_topics.includes(:creator, :original_post).load if request.format.atom?
@@ -32,6 +32,7 @@ class ForumTopicsController < ApplicationController
end
def show
@current_item = @forum_topic
if request.format == Mime::Type.lookup("text/html")
@forum_topic.mark_as_read!(CurrentUser.user)
end

View File

@@ -37,7 +37,7 @@ class PoolsController < ApplicationController
def show
limit = params[:limit].presence || CurrentUser.user.per_page
@pool = Pool.find(params[:id])
@current_item = @pool = Pool.find(params[:id])
@posts = @pool.posts.paginate(params[:page], limit: limit, count: @pool.post_count)
respond_with(@pool)
end

View File

@@ -19,7 +19,7 @@ class PostsController < ApplicationController
end
def show
@post = Post.find(params[:id])
@current_item = @post = Post.find(params[:id])
@comments = @post.comments
@comments = @comments.includes(:creator)

View File

@@ -3,7 +3,7 @@ class TagAliasesController < ApplicationController
respond_to :html, :xml, :json, :js
def show
@tag_alias = TagAlias.find(params[:id])
@current_item = @tag_alias = TagAlias.find(params[:id])
respond_with(@tag_alias)
end

View File

@@ -3,7 +3,7 @@ class TagImplicationsController < ApplicationController
respond_to :html, :xml, :json, :js
def show
@tag_implication = TagImplication.find(params[:id])
@current_item = @tag_implication = TagImplication.find(params[:id])
respond_with(@tag_implication)
end

View File

@@ -3,7 +3,7 @@ class TagsController < ApplicationController
respond_to :html, :xml, :json
def edit
@tag = Tag.find(params[:id])
@current_item = @tag = Tag.find(params[:id])
check_privilege(@tag)
respond_with(@tag)
end
@@ -26,7 +26,7 @@ class TagsController < ApplicationController
end
def show
@tag = Tag.find(params[:id])
@current_item = @tag = Tag.find(params[:id])
respond_with(@tag)
end

View File

@@ -29,7 +29,7 @@ class UploadsController < ApplicationController
end
def show
@upload = Upload.find(params[:id])
@current_item = @upload = Upload.find(params[:id])
respond_with(@upload) do |format|
format.html do
if @upload.is_completed? && @upload.post_id

View File

@@ -14,7 +14,7 @@ class UserFeedbacksController < ApplicationController
end
def show
@user_feedback = UserFeedback.visible.find(params[:id])
@current_item = @user_feedback = UserFeedback.visible.find(params[:id])
respond_with(@user_feedback)
end

View File

@@ -14,7 +14,7 @@ class UserNameChangeRequestsController < ApplicationController
end
def show
@change_request = UserNameChangeRequest.find(params[:id])
@current_item = @change_request = UserNameChangeRequest.find(params[:id])
check_privileges!(@change_request)
respond_with(@change_request)
end

View File

@@ -43,7 +43,7 @@ class UsersController < ApplicationController
end
def show
@user = User.find(params[:id])
@current_item = @user = User.find(params[:id])
respond_with(@user, methods: @user.full_attributes)
end

View File

@@ -8,7 +8,7 @@ class WikiPageVersionsController < ApplicationController
end
def show
@wiki_page_version = WikiPageVersion.find(params[:id])
@current_item = @wiki_page_version = WikiPageVersion.find(params[:id])
respond_with(@wiki_page_version)
end

View File

@@ -30,7 +30,7 @@ class WikiPagesController < ApplicationController
def show
@wiki_page, found_by = WikiPage.find_by_id_or_title(params[:id])
@current_item = @wiki_page
if request.format.html? && @wiki_page.blank? && found_by == :title
@wiki_page = WikiPage.new(title: params[:id])
respond_with @wiki_page, status: 404

View File

@@ -202,10 +202,13 @@ module ApplicationHelper
render "table_builder/table", table: table
end
def body_attributes(user = CurrentUser.user)
attributes = %i[id name level level_string theme] + User::BOOLEAN_ATTRIBUTES.map(&:to_sym)
attributes += User::Roles.map { |role| :"is_#{role}?" }
def body_attributes(user = CurrentUser.user, current_item = nil)
user_attributes = %i[id name level level_string theme] + User::BOOLEAN_ATTRIBUTES.map(&:to_sym)
user_attributes += User::Roles.map { |role| :"is_#{role}?" }
mapped_user_attributes = data_attributes_for(user, "current-user", user_attributes)
model_attributes = (!current_item.nil? ? (!current_item.id.nil? ? [:id] : [] ) + current_item.html_data_attributes : [])
mapped_model_attributes = (!current_item.nil? ? data_attributes_for(current_item, current_item.model_name.singular.dasherize, model_attributes) : {} )
all_mapped_attributes = mapped_user_attributes.merge(mapped_model_attributes)
controller_param = params[:controller].parameterize.dasherize
action_param = params[:action].parameterize.dasherize
@@ -216,17 +219,34 @@ module ApplicationHelper
controller: controller_param,
action: action_param,
layout: controller.class.send(:_layout),
**data_attributes_for(user, "user", attributes)
**all_mapped_attributes
}
}
end
def data_attributes_for(record, prefix, attributes)
attributes.map do |attr|
name = attr.to_s.dasherize.delete("?")
value = record.send(attr)
[:"#{prefix}-#{name}", value]
if attr.kind_of?(Array)
name = attr.map {|sym| sym.to_s.dasherize.delete("?")}.join('-')
value = record
attr.each do |sym|
value = value.send(sym)
if value.nil?
break
end
end
else
name = attr.to_s.dasherize.delete("?")
value = record.send(attr)
end
if value.nil?
value = "null"
end
if prefix.length == 0
[:"#{name}", value]
else
[:"#{prefix}-#{name}", value]
end
end.to_h
end

View File

@@ -0,0 +1,6 @@
module ArtistCommentaryVersionsHelper
def artist_commentary_versions_listing_type
params.dig(:search, :post_id).present? ? :revert : :standard
end
end

View File

@@ -1,4 +1,8 @@
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?

View File

@@ -0,0 +1,6 @@
module PoolVersionsHelper
def pool_versions_listing_type
params.dig(:search, :pool_id).present? ? :revert : :standard
end
end

View File

@@ -1,5 +1,5 @@
module PostVersionsHelper
def post_version_listing
def post_versions_listing_type
params.dig(:search, :post_id).present? ? :revert : :standard
end

View File

@@ -1,7 +1,7 @@
let CurrentUser = {};
CurrentUser.data = function(key) {
return $("body").data(`user-${key}`);
return $("body").data(`current-user-${key}`);
};
CurrentUser.update = function(settings) {

View File

@@ -33,7 +33,7 @@ PostVersion.undo_selected = async function () {
let selected_rows = $("td .post-version-select-checkbox:checked").parents("tr");
for (let row of selected_rows) {
let id = $(row).data("post-version-id");
let id = $(row).data("id");
await $.ajax(`/post_versions/${id}/undo.json`, { method: "PUT" });
updated++;

View File

@@ -1,5 +1,5 @@
div#c-dmails {
tr.read-false {
tr[data-is-read="false"] {
font-weight: bold;
}
}

View File

@@ -1,9 +1,9 @@
div#c-user-feedbacks, div#c-moderator-dashboards div#col2 {
.feedback-category-positive {
[data-category="positive"] {
background: var(--success-background-color);
}
.feedback-category-negative {
[data-category="negative"] {
background: var(--error-background-color);
}
}

View File

@@ -1,30 +1,34 @@
class TableBuilder
class Column
attr_reader :attribute, :name, :block, :html_attributes
attr_reader :attribute, :name, :block, :header_attributes, :body_attributes, :is_html_safe
def initialize(attribute = nil, name: attribute.to_s.titleize, **html_attributes, &block)
def initialize(attribute = nil, header_attributes=nil, body_attributes=nil, is_html_safe=false, &block)
@attribute = attribute
@html_attributes = html_attributes
@name = name
@header_attributes = header_attributes
@body_attributes = body_attributes
@name = attribute.kind_of?(String) ? attribute : attribute.to_s.titleize
@is_html_safe = is_html_safe
@block = block
end
def value(item)
def value(item, i, j)
if block.present?
block.call(item, self)
block.call(item, i, j, self)
nil
else
elsif attribute.kind_of?(Symbol)
item.send(attribute)
else
""
end
end
end
attr_reader :columns, :html_attributes, :items
attr_reader :columns, :table_attributes, :items
def initialize(items, **html_attributes)
def initialize(items, table_attributes=nil)
@items = items
@columns = []
@html_attributes = html_attributes
@table_attributes = table_attributes
yield self if block_given?
end
@@ -32,7 +36,19 @@ class TableBuilder
@columns << Column.new(*options, &block)
end
def row_attributes(item)
{ id: "#{item.model_name.singular}-#{item.id}", "data-id": item.id }
def all_row_attributes(item, i)
if !item.id.nil?
standard_attributes = { id: "#{item.model_name.singular.dasherize}-#{item.id}", "data-id": item.id }
else
standard_attributes = {}
end
if item.html_data_attributes.length > 0
class_attributes = ApplicationController.helpers.data_attributes_for(item, "data", item.html_data_attributes)
else
class_attributes = {}
end
standard_attributes.merge(class_attributes)
end
end

View File

@@ -280,6 +280,10 @@ class ApplicationRecord < ActiveRecord::Base
self.class.api_attributes
end
def html_data_attributes
[]
end
def serializable_hash(options = {})
options ||= {}
options[:only] ||= []

View File

@@ -517,6 +517,12 @@ class Artist < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:creator_id]
end
end
include UrlMethods
include NameMethods
include VersionMethods
@@ -525,6 +531,7 @@ class Artist < ApplicationRecord
include TagMethods
include BanMethods
extend SearchMethods
include ApiMethods
def status
if is_banned? && is_active?

View File

@@ -139,6 +139,13 @@ class ArtistCommentary < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:post_id]
end
end
extend SearchMethods
include VersionMethods
include ApiMethods
end

View File

@@ -7,4 +7,12 @@ class ArtistCommentaryVersion < ApplicationRecord
q = q.search_attributes(params, :post, :updater, :original_title, :original_description, :translated_title, :translated_description)
q.apply_default_order(params)
end
module ApiMethods
def html_data_attributes
[:post_id, :updater_id]
end
end
include ApiMethods
end

View File

@@ -23,7 +23,14 @@ class ArtistVersion < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:artist_id, :updater_id]
end
end
extend SearchMethods
include ApiMethods
def previous
ArtistVersion.where("artist_id = ? and created_at < ?", artist_id, created_at).order("created_at desc").first

View File

@@ -44,6 +44,14 @@ class Ban < ApplicationRecord
q
end
module ApiMethods
def html_data_attributes
[:user_id, :banner_id, :expired?]
end
end
include ApiMethods
def self.prune!
expired.includes(:user).find_each do |ban|
ban.user.unban! if ban.user.ban_expired?

View File

@@ -135,9 +135,16 @@ class BulkUpdateRequest < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:user_id, :approver_id, :forum_topic_id, :forum_post_id]
end
end
extend SearchMethods
include ApprovalMethods
include ValidationMethods
include ApiMethods
concerning :EmbeddedText do
class_methods do

View File

@@ -51,4 +51,12 @@ class CommentVote < ApplicationRecord
def initialize_user
self.user_id = CurrentUser.user.id
end
module ApiMethods
def html_data_attributes
[:comment_id, :user_id]
end
end
include ApiMethods
end

View File

@@ -146,9 +146,16 @@ class Dmail < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:owner_id, :from_id, :to_id, :is_read?]
end
end
include AddressMethods
include FactoryMethods
extend SearchMethods
include ApiMethods
def validate_sender_is_not_banned
if from.try(:is_banned?)

View File

@@ -70,7 +70,14 @@ class FavoriteGroup < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:creator_id]
end
end
extend SearchMethods
include ApiMethods
def self.name_to_id(name)
if name =~ /^\d+$/

View File

@@ -65,11 +65,22 @@ class ForumPost < ApplicationRecord
q = q.joins(:topic).where("forum_topics.category_id = ?", params[:topic_category_id].to_i)
end
unless params[:is_deleted].present?
q = q.active
end
q.apply_default_order(params)
end
end
module ApiMethods
def html_data_attributes
[:topic_id, :creator_id, :updater_id, :is_deleted?, [:topic, :is_deleted?]]
end
end
extend SearchMethods
include ApiMethods
def self.new_reply(params)
if params[:topic_id]

View File

@@ -53,4 +53,12 @@ class ForumPostVote < ApplicationRecord
raise
end
end
module ApiMethods
def html_data_attributes
[:forum_post_id, :creator_id]
end
end
include ApiMethods
end

View File

@@ -80,6 +80,10 @@ class ForumTopic < ApplicationRecord
q = q.apply_default_order(params)
end
unless params[:is_deleted].present?
q = q.active
end
q
end
end
@@ -127,10 +131,17 @@ class ForumTopic < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:creator_id, :updater_id, :category_id]
end
end
extend SearchMethods
include CategoryMethods
include VisitMethods
include SubscriptionMethods
include ApiMethods
def editable_by?(user)
(creator_id == user.id || user.is_moderator?) && visible?(user)

View File

@@ -42,4 +42,12 @@ class IpAddress < ApplicationRecord
def readonly?
true
end
module ApiMethods
def html_data_attributes
[:user_id]
end
end
include ApiMethods
end

View File

@@ -42,4 +42,12 @@ class IpBan < ApplicationRecord
str += "/" + ip_addr.prefix.to_s if has_subnet?
str
end
module ApiMethods
def html_data_attributes
[:creator_id]
end
end
include ApiMethods
end

View File

@@ -83,4 +83,12 @@ class ModAction < ApplicationRecord
def initialize_creator
self.creator_id = CurrentUser.id
end
module ApiMethods
def html_data_attributes
[:category_id, :creator_id]
end
end
include ApiMethods
end

View File

@@ -2,4 +2,12 @@ class NewsUpdate < ApplicationRecord
belongs_to_creator
belongs_to_updater
scope :recent, -> {where("created_at >= ?", 2.weeks.ago).order("created_at desc").limit(5)}
module ApiMethods
def html_data_attributes
[:creator_id, :updater_id]
end
end
include ApiMethods
end

View File

@@ -157,4 +157,12 @@ class Note < ApplicationRecord
end
end
end
module ApiMethods
def html_data_attributes
[:post_id, :creator_id, :version]
end
end
include ApiMethods
end

View File

@@ -15,4 +15,12 @@ class NoteVersion < ApplicationRecord
def previous
NoteVersion.where("note_id = ? and updated_at < ?", note_id, updated_at).order("updated_at desc").first
end
module ApiMethods
def html_data_attributes
[:note_id, :post_id, :updater_id, :version]
end
end
include ApiMethods
end

View File

@@ -95,7 +95,14 @@ class Pool < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:creator_id]
end
end
extend SearchMethods
include ApiMethods
def self.name_to_id(name)
if name =~ /^\d+$/

View File

@@ -33,7 +33,14 @@ class PoolArchive < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:pool_id, :updater_id, :version]
end
end
extend SearchMethods
include ApiMethods
def self.sqs_service
SqsService.new(Danbooru.config.aws_sqs_archives_url)

View File

@@ -1481,6 +1481,10 @@ class Post < ApplicationRecord
hash
end
def html_data_attributes
[:uploader_id, :approver_id]
end
def status
if is_pending?
"pending"

View File

@@ -36,7 +36,14 @@ class PostAppeal < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:post_id, :creator_id]
end
end
extend SearchMethods
include ApiMethods
def resolved?
post.present? && !post.is_deleted? && !post.is_flagged?

View File

@@ -37,4 +37,12 @@ class PostApproval < ApplicationRecord
q = q.search_attributes(params, :user, :post)
q.apply_default_order(params)
end
module ApiMethods
def html_data_attributes
[:post_id, :user_id]
end
end
include ApiMethods
end

View File

@@ -75,8 +75,15 @@ class PostArchive < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:post_id, :updater_id, :version]
end
end
extend SearchMethods
include ArchiveServiceMethods
include ApiMethods
def tag_array
tags.split

View File

@@ -67,4 +67,12 @@ class PostDisapproval < ApplicationRecord
end
end
end
module ApiMethods
def html_data_attributes
[:post_id, :user_id]
end
end
include ApiMethods
end

View File

@@ -94,13 +94,24 @@ class PostFlag < ApplicationRecord
end
end
def api_attributes
attributes = super + [:category]
attributes -= [:creator_id] unless CurrentUser.can_view_flagger_on_post?(self)
attributes
module ApiMethods
def api_attributes
attributes = super + [:category]
attributes -= [:creator_id] unless CurrentUser.can_view_flagger_on_post?(self)
attributes
end
def html_data_attributes
attributes = [:post_id]
if CurrentUser.can_view_flagger_on_post?(self)
attributes += [:creator_id]
end
attributes
end
end
extend SearchMethods
include ApiMethods
def category
case reason

View File

@@ -28,6 +28,14 @@ class PostReplacement < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:post_id, :creator_id]
end
end
include ApiMethods
def suggested_tags_for_removal
tags = post.tag_array.select { |tag| Danbooru.config.remove_tag_after_replacement?(tag) }
tags = tags.map { |tag| "-#{tag}" }

View File

@@ -68,4 +68,12 @@ class PostVote < ApplicationRecord
1
end
end
module ApiMethods
def html_data_attributes
[:post_id, :user_id]
end
end
include ApiMethods
end

View File

@@ -171,4 +171,12 @@ class SavedSearch < ApplicationRecord
def disable_labels=(value)
CurrentUser.update(disable_categorized_saved_searches: true) if value.to_s.truthy?
end
module ApiMethods
def html_data_attributes
[:user_id]
end
end
include ApiMethods
end

View File

@@ -69,6 +69,10 @@ class Tag < ApplicationRecord
"ambiguous" => false
}.to_json
end
def html_data_attributes
[:category]
end
end
class CategoryMapping

View File

@@ -197,6 +197,12 @@ class TagRelationship < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:creator_id, :approver_id, :forum_topic_id, :forum_post_id]
end
end
concerning :EmbeddedText do
class_methods do
def embedded_pattern
@@ -234,4 +240,5 @@ class TagRelationship < ApplicationRecord
extend SearchMethods
include MessageMethods
include ApiMethods
end

View File

@@ -228,12 +228,19 @@ class Upload < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:post_id, :uploader_id]
end
end
include FileMethods
include StatusMethods
include UploaderMethods
include VideoMethods
extend SearchMethods
include SourceMethods
include ApiMethods
def uploader_is_not_limited
if !uploader.can_upload?

View File

@@ -614,6 +614,10 @@ class User < ApplicationRecord
}.to_json
end
def html_data_attributes
[:inviter_id]
end
def api_token
api_key.try(:key)
end

View File

@@ -40,7 +40,14 @@ class UserFeedback < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:user_id, :creator_id, :category]
end
end
extend SearchMethods
include ApiMethods
def user_name=(name)
self.user = User.find_by_name(name)

View File

@@ -18,6 +18,14 @@ class UserNameChangeRequest < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:user_id]
end
end
include ApiMethods
def update_name!
user.update!(name: desired_name)
end

View File

@@ -115,7 +115,14 @@ class WikiPage < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:category_name]
end
end
extend SearchMethods
include ApiMethods
def validate_not_locked
if is_locked? && !CurrentUser.is_builder?

View File

@@ -17,7 +17,14 @@ class WikiPageVersion < ApplicationRecord
end
end
module ApiMethods
def html_data_attributes
[:wiki_page_id, :updater_id]
end
end
extend SearchMethods
include ApiMethods
def pretty_title
title.tr("_", " ")

View File

@@ -4,30 +4,19 @@
<%= render "posts/partials/common/inline_blacklist" %>
<table width="100%" class="striped">
<thead>
<tr>
<th width="1%">Post</th>
<th>Original</th>
<th>Translated</th>
</tr>
</thead>
<tbody>
<% @commentaries.each do |commentary| %>
<tr>
<td><%= PostPresenter.preview(commentary.post, :tags => "status:any") %></td>
<td>
<%= format_commentary_title(commentary.original_title) %>
<%= format_commentary_description(commentary.original_description) %>
</td>
<td>
<%= format_commentary_title(commentary.translated_title) %>
<%= format_commentary_description(commentary.translated_description) %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @commentaries, {class: "striped", width: "100%"} do |t| %>
<% t.column "Post", {width: "1%"} do |commentary| %>
<%= PostPresenter.preview(commentary.post, :tags => "status:any") %>
<% end %>
<% t.column "Original" do |commentary| %>
<%= format_commentary_title(commentary.original_title) %>
<%= format_commentary_description(commentary.original_description) %>
<% end %>
<% t.column "Translated" do |commentary| %>
<%= format_commentary_title(commentary.translated_title) %>
<%= format_commentary_description(commentary.translated_description) %>
<% end %>
<% end %>
<%= numbered_paginator(@commentaries) %>
</div>

View File

@@ -0,0 +1,42 @@
<div id="p-<%= artist_commentary_versions_listing_type %>-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") %>
<% 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}) %>
<% end %>
<% end %>
<% t.column "Original" do |commentary_version| %>
<%= format_commentary_title(commentary_version.original_title) %>
<%= format_commentary_description(commentary_version.original_description) %>
<% end %>
<% t.column "Translated" do |commentary_version| %>
<%= format_commentary_title(commentary_version.translated_title) %>
<%= format_commentary_description(commentary_version.translated_description) %>
<% end %>
<% if CurrentUser.is_moderator? %>
<% t.column "IP Address", {width: "10%"} do |commentary_version| %>
<%= link_to_ip commentary_version.updater_ip_addr %>
<% end %>
<% end %>
<% t.column "Edited by", {width: "10%"} do |commentary_version| %>
<%= link_to_user commentary_version.updater %>
<% end %>
<% t.column "Date", {width: "10%"} do |commentary_version| %>
<%= compact_time commentary_version.updated_at %>
<% end %>
<% if artist_commentary_versions_listing_type == :revert %>
<% t.column "", {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 %>
<% end %>
<% end %>
</div>

View File

@@ -1,46 +0,0 @@
<div id="p-revert-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th width="5%">Post</th>
<th>Original</th>
<th>Translated</th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="10%">Edited By</th>
<th width="10%">Date</th>
<% if CurrentUser.is_member? %>
<th width="7%"></th>
<% end %>
</tr>
</thead>
<tbody>
<% @commentary_versions.each do |commentary_version| %>
<tr>
<td><%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %></td>
<td>
<%= format_commentary_title(commentary_version.original_title) %>
<%= format_commentary_description(commentary_version.original_description) %>
</td>
<td>
<%= format_commentary_title(commentary_version.translated_title) %>
<%= format_commentary_description(commentary_version.translated_description) %>
</td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip commentary_version.updater_ip_addr %>
</td>
<% end %>
<td><%= link_to_user commentary_version.updater %></td>
<td><%= compact_time commentary_version.updated_at %></td>
<% if CurrentUser.is_member? %>
<td>
<%= 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?"} %>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -1,40 +0,0 @@
<div id="p-standard-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th width="5%">Post</th>
<th>Version</th>
<th>Original</th>
<th>Translated</th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="10%">Edited By</th>
<th width="10%">Date</th>
</tr>
</thead>
<tbody>
<% @commentary_versions.each do |commentary_version| %>
<tr>
<td><%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %></td>
<td><%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}) %></td>
<td>
<%= format_commentary_title(commentary_version.original_title) %>
<%= format_commentary_description(commentary_version.original_description) %>
</td>
<td>
<%= format_commentary_title(commentary_version.translated_title) %>
<%= format_commentary_description(commentary_version.translated_description) %>
</td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip commentary_version.updater_ip_addr %>
</td>
<% end %>
<td><%= link_to_user commentary_version.updater %></td>
<td><%= compact_time commentary_version.updated_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -4,11 +4,7 @@
<%= render "posts/partials/common/inline_blacklist" %>
<% if params.dig(:search, :post_id).present? %>
<%= render "revert_listing" %>
<% else %>
<%= render "standard_listing" %>
<% end %>
<%= render "listing" %>
<%= numbered_paginator(@commentary_versions) %>

View File

@@ -0,0 +1,43 @@
<div id="p-<%= artist_versions_listing_type %>-listing">
<%= table_for @artist_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Name" do |artist_version| %>
<% if artist_version.visible? %>
<%= 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 %>
<% end %>
<% end %>
<% t.column "Other Names" do |artist_version| %>
<% if artist_version.visible? %>
<%= artist_version_other_names_diff(artist_version) %>
<% end %>
<% end %>
<% t.column "URLs", nil, {class: "col-expand"} do |artist_version| %>
<%= artist_version_urls_diff(artist_version) if artist_version.visible? %>
<% 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 }) %>
<p>
<%= compact_time(artist_version.updated_at) %>
<% if CurrentUser.is_moderator? %>
(<%= link_to_ip artist_version.updater_ip_addr %>)
<% end %>
</p>
<% end %>
<% if artist_versions_listing_type == :revert %>
<% t.column "" do |artist_version| %>
<td><%= 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?" %></td>
<% end %>
<% end %>
<% end %>
</div>

View File

@@ -1,55 +0,0 @@
<div id="p-<%= artist_versions_listing_type %>-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th>Name</th>
<th>Other Names</th>
<th>URLs</th>
<th>Updated</th>
<% if artist_versions_listing_type == :revert %>
<th></th>
<% end %>
</tr>
</thead>
<tbody>
<% @artist_versions.each do |artist_version| %>
<tr>
<% if artist_version.visible? %>
<td>
<%= 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 %>
</td>
<td><%= artist_version_other_names_diff(artist_version) %></td>
<% else %>
<td></td>
<td></td>
<% end %>
<td class="col-expand">
<%= artist_version_urls_diff(artist_version) if artist_version.visible? %>
</td>
<td>
<%= link_to_user artist_version.updater %>
<%= link_to "»", artist_versions_path(search: { updater_name: artist_version.updater.name }) %>
<p>
<%= compact_time(artist_version.updated_at) %>
<% if CurrentUser.is_moderator? %>
(<%= link_to_ip artist_version.updater_ip_addr %>)
<% end %>
</p>
</td>
<% if artist_versions_listing_type == :revert %>
<td><%= 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?" %></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -2,8 +2,10 @@
<div id="a-index">
<h1>Artist History</h1>
<%= render "standard_listing" %>
<%= render "listing" %>
<%= numbered_paginator(@artist_versions, :search_count => params[:search]) %>
</div>
</div>

View File

@@ -2,58 +2,43 @@
<div id="a-index">
<%= render "search" %>
<table class="striped autofit">
<thead>
<tr>
<th>Name</th>
<th>Other Names</th>
<th>Status</th>
<th>Updated</th>
<th></th>
</tr>
</thead>
<tbody>
<% @artists.each do |artist| %>
<%= tag.tr id: "artist-#{artist.id}" do %>
<td>
<%= link_to artist.name, artist, class: "tag-type-#{Tag.categories.artist}" %>
<span class="post-count"><%= artist.tag.try(:post_count) || 0 %></span>
<% if !artist.group_name.blank? %>
(group: <%= link_to artist.group_name, artist %>)
<% end %>
</td>
<td class="col-expand">
<% artist.other_names.each do |name| %>
<%= link_to name, artists_path(search: { any_name_matches: name }), class: "artist-other-name" %>
<% end %>
</td>
<td>
<% if !artist.is_active? %>
<%= link_to "Deleted", artists_path(search: { is_active: false }) %>
<% end %>
<%= table_for @artists, {class: "striped autofit"} do |t| %>
<% t.column "Name" do |artist| %>
<%= link_to artist.name, artist, class: "tag-type-#{Tag.categories.artist}" %>
<span class="post-count"><%= artist.tag.try(:post_count) || 0 %></span>
<% if !artist.group_name.blank? %>
(group: <%= link_to artist.group_name, artist %>)
<% end %>
<% end %>
<% t.column "Other Names", nil, {class: "col-expand"} do |artist| %>
<% artist.other_names.each do |name| %>
<%= link_to name, artists_path(search: { any_name_matches: name }), class: "artist-other-name" %>
<% end %>
<% end %>
<% t.column "Status" do |artist| %>
<% if !artist.is_active? %>
<%= link_to "Deleted", artists_path(search: { is_active: false }) %>
<% end %>
<% if artist.is_banned? %>
<%= link_to "Banned", artists_path(search: { is_banned: true }) %>
<% end %>
</td>
<td>
<%= time_ago_in_words_tagged(artist.updated_at) %>
</td>
<td>
<% if CurrentUser.is_member? %>
<%= link_to "Edit", edit_artist_path(artist) %>
<% if artist.is_banned? %>
<%= link_to "Banned", artists_path(search: { is_banned: true }) %>
<% end %>
<% end %>
<% t.column "Updated" do |artist| %>
<%= time_ago_in_words_tagged(artist.updated_at) %>
<% end %>
<% t.column "" do |artist| %>
<% if CurrentUser.is_member? %>
<%= link_to "Edit", edit_artist_path(artist) %>
<% if artist.is_active? %>
| <%= link_to "Delete", artist_path(artist, artist: { is_active: false }), method: :put, remote: true %>
<% else %>
| <%= link_to "Undelete", artist_path(artist, artist: { is_active: true }), method: :put, remote: true %>
<% end %>
<% end %>
</td>
<% if artist.is_active? %>
| <%= link_to "Delete", artist_path(artist, artist: { is_active: false }), method: :put, remote: true %>
<% else %>
| <%= link_to "Undelete", artist_path(artist, artist: { is_active: true }), method: :put, remote: true %>
<% end %>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<%= numbered_paginator(@artists) %>
</div>

View File

@@ -4,44 +4,31 @@
<%= render "search" %>
<table class="striped autofit">
<thead>
<tr>
<th>Banned User</th>
<th>Duration</th>
<th>Reason</th>
<th>Banner</th>
<th></th>
</tr>
</thead>
<tbody>
<% @bans.each do |ban| %>
<tr id="ban-<%= ban.id %>" data-expired="<%= ban.expired? %>">
<td>
<%= link_to_user(ban.user) %>
<%= link_to "»", bans_path(search: search_params.merge(user_name: ban.user.name)) %>
</td>
<td><%= humanized_duration(ban.created_at, ban.expires_at) %></td>
<td class="col-expand">
<div class="prose">
<%= format_text ban.reason %>
</div>
</td>
<td>
<%= link_to_user ban.banner %>
<%= link_to "»", bans_path(search: { banner_name: ban.banner.name }) %>
<div><%= time_ago_in_words_tagged(ban.created_at) %></div>
</td>
<td>
<% if CurrentUser.is_moderator? %>
<%= link_to "Edit", edit_ban_path(ban) %>
| <%= link_to "Delete", ban_path(ban), :method => :delete, :remote => true %>
<% end %>
</td>
</tr>
<%= table_for @bans, {class: "striped autofit"} do |t| %>
<% t.column "Banned User" do |ban| %>
<%= link_to_user(ban.user) %>
<%= link_to "»", bans_path(search: search_params.merge(user_name: ban.user.name)) %>
<% end %>
<% t.column "Duration" do |ban| %>
<%= humanized_duration(ban.created_at, ban.expires_at) %>
<% end %>
<% t.column "Reason", nil, {class: "col-expand"} do |ban| %>
<div class="prose">
<%= format_text ban.reason %>
</div>
<% end %>
<% t.column "Banner" do |ban| %>
<%= link_to_user ban.banner %>
<%= link_to "»", bans_path(search: { banner_name: ban.banner.name }) %>
<div><%= time_ago_in_words_tagged(ban.created_at) %></div>
<% end %>
<% t.column "" do |ban| %>
<% if CurrentUser.is_moderator? %>
<%= link_to "Edit", edit_ban_path(ban) %>
| <%= link_to "Delete", ban_path(ban), :method => :delete, :remote => true %>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<%= numbered_paginator(@bans) %>
</div>

View File

@@ -1,49 +1,35 @@
<table class="striped" width="100%">
<thead>
<tr>
<th>Request</th>
<th>Votes</th>
<th>Status</th>
<th>Created</th>
<th></th>
</tr>
</thead>
<tbody>
<% bulk_update_requests.each do |request| %>
<tr id="request-<%= request.id %>">
<td>
<% if request.forum_post.present? %>
<p><%= link_to "Topic ##{request.forum_topic_id}: #{request.forum_topic.title}", forum_topic_path(request.forum_topic_id, page: request.forum_post.forum_topic_page, anchor: "forum_post_#{request.forum_post_id}") %></p>
<% elsif request.forum_topic.present? %>
<p><%= link_to "Topic ##{request.forum_topic_id}: #{request.forum_topic.title}", request.forum_topic %></p>
<% end %>
<%= table_for bulk_update_requests, {class: "striped", width: "100%"} do |t| %>
<% t.column "Request" do |request| %>
<% if request.forum_post.present? %>
<p><%= link_to "Topic ##{request.forum_topic_id}: #{request.forum_topic.title}", forum_topic_path(request.forum_topic_id, page: request.forum_post.forum_topic_page, anchor: "forum_post_#{request.forum_post_id}") %></p>
<% elsif request.forum_topic.present? %>
<p><%= link_to "Topic ##{request.forum_topic_id}: #{request.forum_topic.title}", request.forum_topic %></p>
<% end %>
<%= script_with_line_breaks(request.script) %>
</td>
<td>
<% if request.forum_post.present? %>
<%= link_to forum_post_votes_path(search: { forum_post_id: request.forum_post_id }) do %>
+<%= request.forum_post.votes.select(&:up?).count %> /
-<%= request.forum_post.votes.select(&:down?).count %>
<% end %>
<% end %>
</td>
<td id="request-status-for-<%= request.id %>">
<%= request.status %>
<% if request.is_approved? %>
<br>by <%= link_to_user request.approver %>
<% end %>
</td>
<td>
<%= link_to_user request.user %>
<%= link_to "»", bulk_update_requests_path(search: { user_name: request.user.name }) %>
<div><%= time_ago_in_words_tagged(request.created_at) %></div>
</td>
<td>
<%= link_to "Show", bulk_update_request_path(request) %> |
<%= render "bulk_update_requests/bur_edit_links", bur: request %>
</td>
</tr>
<%= script_with_line_breaks(request.script) %>
<% end %>
<% t.column "Votes" do |request| %>
<% if request.forum_post.present? %>
<%= link_to forum_post_votes_path(search: { forum_post_id: request.forum_post_id }) do %>
+<%= request.forum_post.votes.select(&:up?).count %> /
-<%= request.forum_post.votes.select(&:down?).count %>
<% end %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Status" do |request| %>
<%= request.status %>
<% if request.is_approved? %>
<br>by <%= link_to_user request.approver %>
<% end %>
<% end %>
<% t.column "Created" do |request| %>
<%= link_to_user request.user %>
<%= link_to "»", bulk_update_requests_path(search: { user_name: request.user.name }) %>
<div><%= time_ago_in_words_tagged(request.created_at) %></div>
<% end %>
<% t.column "" do |request| %>
<%= link_to "Show", bulk_update_request_path(request) %> |
<%= render "bulk_update_requests/bur_edit_links", bur: request %>
<% end %>
<% end %>

View File

@@ -10,48 +10,34 @@
<%= f.submit "Search" %>
<% end %>
<table class="striped autofit">
<thead>
<tr>
<th>Post</th>
<th>Comment</th>
<th>Score</th>
<th>Commenter</th>
<th>Voter</th>
<th></th>
</tr>
</thead>
<tbody>
<% @comment_votes.each do |vote| %>
<tr>
<td>
<%= PostPresenter.preview(vote.comment.post, show_deleted: true) %>
</td>
<td class="col-expand">
<div class="prose">
<%= format_text(vote.comment.body) %>
</div>
</td>
<td><%= link_to sprintf("%+d", vote.score), comment_votes_path(search: { score: vote.score }) %></td>
<td>
<%= link_to_user vote.comment.creator %>
<%= link_to "»", comment_votes_path(search: { comment: { creator_name: vote.comment.creator_name }}) %>
<div><%= time_ago_in_words_tagged(vote.comment.created_at) %></div>
</td>
<td>
<%= link_to_user vote.user %>
<%= link_to "»", comment_votes_path(search: { user_name: vote.user.name }) %>
<div><%= time_ago_in_words_tagged(vote.created_at) %></div>
</td>
<td>
<% if vote.user == CurrentUser.user %>
<%= link_to "unvote", comment_comment_votes_path(vote.comment), remote: true, method: :delete %>
<% end %>
</td>
</tr>
<%= table_for @comment_votes, {class: "striped autofit"} do |t| %>
<% t.column "Post" do |vote| %>
<%= PostPresenter.preview(vote.comment.post, show_deleted: true) %>
<% end %>
<% t.column "Comment", nil, {class: "col-expand"} do |vote| %>
<div class="prose">
<%= format_text(vote.comment.body) %>
</div>
<% end %>
<% t.column "Score" do |vote| %>
<%= link_to sprintf("%+d", vote.score), comment_votes_path(search: { score: vote.score }) %>
<% end %>
<% t.column "Commenter" do |vote| %>
<%= link_to_user vote.comment.creator %>
<%= link_to "»", comment_votes_path(search: { comment: { creator_name: vote.comment.creator_name }}) %>
<div><%= time_ago_in_words_tagged(vote.comment.created_at) %></div>
<% end %>
<% t.column "Voter" do |vote| %>
<%= link_to_user vote.user %>
<%= link_to "»", comment_votes_path(search: { user_name: vote.user.name }) %>
<div><%= time_ago_in_words_tagged(vote.created_at) %></div>
<% end %>
<% t.column "" do |vote| %>
<% if vote.user == CurrentUser.user %>
<%= link_to "unvote", comment_comment_votes_path(vote.comment), remote: true, method: :delete %>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<%= numbered_paginator(@comment_votes) %>
</div>

View File

@@ -2,55 +2,41 @@
<div id="a-index">
<h1>Delayed Jobs</h1>
<table class="striped autofit">
<thead>
<tr>
<th>Queue</th>
<th>Name</th>
<% if CurrentUser.is_admin? %>
<th>Handler</th>
<% end %>
<th>Attempts</th>
<th>Last error</th>
<th>Failed at</th>
<th>Run at</th>
<th></th>
</tr>
</thead>
<tbody>
<% @delayed_jobs.each do |job| %>
<tr>
<td><%= job.queue %></td>
<td><%= raw print_name(job) %></td>
<% if CurrentUser.is_admin? %>
<td class="col-expand"><%= raw print_handler(job) %></td>
<% end %>
<td><%= job.attempts %></td>
<td class="col-expand">
<% if job.last_error %>
<%= job.last_error.split(/\n/)[0] %>
<%= job.last_error.split(/\n/)[1..-1].grep(/releases/).join("\n") %>
<% end %>
</td>
<td><%= time_ago_in_words_tagged(job.failed_at) if job.failed_at %></td>
<td><%= time_ago_in_words_tagged(job.run_at) %></td>
<td>
<% if CurrentUser.is_admin? %>
<% if job.locked_at? %>
Running
<% elsif job.failed? %>
<%= link_to "Retry", retry_delayed_job_path(job), method: :put, remote: true %> |
<%= link_to "Delete", delayed_job_path(job), method: :delete, remote: true %>
<% else %>
<%= link_to "Run", run_delayed_job_path(job), method: :put, remote: true %> |
<%= link_to "Cancel", cancel_delayed_job_path(job), method: :put, remote: true %>
<% end %>
<% end %>
</td>
</tr>
<%= table_for @delayed_jobs, {class: "striped autofit"} do |t| %>
<% t.column :queue %>
<% t.column "Name" do |job| %>
<%= raw print_name(job) %>
<% end %>
<% t.column "Handler", nil, {class: "col-expand"} do |job| %>
<%= raw print_handler(job) %>
<% end %>
<% t.column :attempts %>
<% t.column "Last error", nil, {class: "col-expand"} do |job| %>
<% if job.last_error %>
<%= job.last_error.split(/\n/)[0] %>
<%= job.last_error.split(/\n/)[1..-1].grep(/releases/).join("\n") %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Failed at" do |job| %>
<%= time_ago_in_words_tagged(job.failed_at) if job.failed_at %>
<% end %>
<% t.column "Run at" do |job| %>
<%= time_ago_in_words_tagged(job.run_at) %>
<% end %>
<% t.column "" do |job| %>
<% if CurrentUser.is_admin? %>
<% if job.locked_at? %>
Running
<% elsif job.failed? %>
<%= link_to "Retry", retry_delayed_job_path(job), method: :put, remote: true %> |
<%= link_to "Delete", delayed_job_path(job), method: :delete, remote: true %>
<% else %>
<%= link_to "Run", run_delayed_job_path(job), method: :put, remote: true %> |
<%= link_to "Cancel", cancel_delayed_job_path(job), method: :put, remote: true %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= numbered_paginator(@delayed_jobs) %>
</div>

View File

@@ -10,42 +10,31 @@
<%= render "search" %>
<table class="striped" width="100%">
<thead>
<tr>
<th>Date</th>
<th>From</th>
<th>To</th>
<th>Subject</th>
<th></th>
</tr>
</thead>
<tbody>
<% @dmails.each do |dmail| %>
<tr class="read-<%= dmail.is_read? %>">
<td><%= compact_time(dmail.created_at) %></td>
<td>
<% if dmail.filtered? %>
<%= link_to "[filtered]", user_path(dmail.from) %>
<% else %>
<%= link_to_user dmail.from %>
<% end %>
</td>
<td><%= link_to_user dmail.to %></td>
<td>
<% if dmail.filtered? %>
<%= link_to "[filtered]", dmail_path(dmail) %>
<% else %>
<%= link_to dmail.title, dmail_path(dmail) %>
<% end %>
</td>
<td>
<%= link_to "delete", dmail_path(dmail), :method => :delete, :data => {:confirm => "Are you sure you want to delete this Dmail?"} %>
</td>
</tr>
<%= table_for @dmails, {class: "striped", width: "100%"} do |t| %>
<% t.column "Date" do |dmail| %>
<%= compact_time(dmail.created_at) %>
<% end %>
<% t.column "From" do |dmail| %>
<% if dmail.filtered? %>
<%= link_to "[filtered]", user_path(dmail.from) %>
<% else %>
<%= link_to_user dmail.from %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "To" do |dmail| %>
<%= link_to_user dmail.from %>
<% end %>
<% t.column "Subject" do |dmail| %>
<% if dmail.filtered? %>
<%= link_to "[filtered]", dmail_path(dmail) %>
<% else %>
<%= link_to dmail.title, dmail_path(dmail) %>
<% end %>
<% end %>
<% t.column "" do |dmail| %>
<%= link_to "delete", dmail_path(dmail), :method => :delete, :data => {:confirm => "Are you sure you want to delete this Dmail?"} %>
<% end %>
<% end %>
<%= numbered_paginator(@dmails) %>
</div>

View File

@@ -1,33 +1,18 @@
<div id="c-favorite-groups">
<div id="a-index">
<table class="striped" width="100%">
<thead>
<tr>
<th width="5%"></th>
<th width="60%">Name</th>
<th width="10%">Count</th>
</tr>
</thead>
<tbody>
<% @favorite_groups.each do |favgroup| %>
<%= content_tag(:tr, :id => "favorite-group-#{favgroup.id}") do %>
<td>
</td>
<td>
<%= link_to favgroup.pretty_name, favorite_group_path(favgroup) %>
<% if favgroup.post_count > CurrentUser.user.per_page %>
<%= link_to "page #{favgroup.last_page}", favorite_group_path(favgroup, :page => favgroup.last_page), :class => "last-page" %>
<% end %>
</td>
<td>
<%= favgroup.post_count %>
</td>
<% end %>
<%= table_for @favorite_groups, {class: "striped", width: "100%"} do |t| %>
<% t.column nil, {width: "5%"} %>
<% t.column "Name", {width: "60%"} do |favgroup| %>
<%= link_to favgroup.pretty_name, favorite_group_path(favgroup) %>
<% if favgroup.post_count > CurrentUser.user.per_page %>
<%= link_to "page #{favgroup.last_page}", favorite_group_path(favgroup, :page => favgroup.last_page), :class => "last-page" %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Count", {width: "10%"} do |favgroup| %>
<%= favgroup.post_count %>
<% end %>
<% end %>
<%= render "secondary_links" %>
</div>

View File

@@ -10,49 +10,33 @@
<%= f.submit "Search" %>
<% end %>
<table class="striped autofit">
<thead>
<tr>
<th>Forum Post</th>
<th>Forum Topic</th>
<th>Score</th>
<th>Forum Poster</th>
<th>Voter</th>
<th></th>
</tr>
</thead>
<tbody>
<% @forum_post_votes.each do |forum_post_vote| %>
<tr>
<td>
<%= link_to "Forum ##{forum_post_vote.forum_post_id}", forum_post_vote.forum_post %>
<%= link_to "»", forum_post_votes_path(search: { forum_post_id: forum_post_vote.forum_post_id }) %>
</td>
<td class="col-expand">
<%= link_to forum_post_vote.forum_post.topic.title, forum_post_vote.forum_post.topic %>
</td>
<td>
<%= link_to sprintf("%+d", forum_post_vote.score), forum_post_votes_path(search: { score: forum_post_vote.score }) %>
</td>
<td>
<%= link_to_user forum_post_vote.forum_post.creator %>
<%= link_to "»", forum_post_votes_path(search: { forum_post: { creator_name: forum_post_vote.forum_post.creator.name }}) %>
<div><%= time_ago_in_words_tagged(forum_post_vote.forum_post.created_at) %></div>
</td>
<td>
<%= link_to_user forum_post_vote.creator %>
<%= link_to "»", forum_post_votes_path(search: { creator_name: forum_post_vote.creator.name }) %>
<div><%= time_ago_in_words_tagged(forum_post_vote.created_at) %></div>
</td>
<td>
<% if forum_post_vote.creator == CurrentUser.user %>
<%= link_to "unvote", forum_post_vote_path(forum_post_vote, format: "js"), remote: true, method: :delete %>
<% end %>
</td>
</tr>
<%= table_for @forum_post_votes, {class: "striped autofit"} do |t| %>
<% t.column "Forum Post" do |forum_post_vote| %>
<%= link_to "Forum ##{forum_post_vote.forum_post_id}", forum_post_vote.forum_post %>
<%= link_to "»", forum_post_votes_path(search: { forum_post_id: forum_post_vote.forum_post_id }) %>
<% end %>
<% t.column "Forum Topic", nil, {class: "col-expand"} do |forum_post_vote| %>
<%= link_to forum_post_vote.forum_post.topic.title, forum_post_vote.forum_post.topic %>
<% end %>
<% t.column "Score" do |forum_post_vote| %>
<%= link_to sprintf("%+d", forum_post_vote.score), forum_post_votes_path(search: { score: forum_post_vote.score }) %>
<% end %>
<% t.column "Forum Poster" do |forum_post_vote| %>
<%= link_to_user forum_post_vote.forum_post.creator %>
<%= link_to "»", forum_post_votes_path(search: { forum_post: { creator_name: forum_post_vote.forum_post.creator.name }}) %>
<div><%= time_ago_in_words_tagged(forum_post_vote.forum_post.created_at) %></div>
<% end %>
<% t.column "Voter" do |forum_post_vote| %>
<%= link_to_user forum_post_vote.creator %>
<%= link_to "»", forum_post_votes_path(search: { creator_name: forum_post_vote.creator.name }) %>
<div><%= time_ago_in_words_tagged(forum_post_vote.created_at) %></div>
<% end %>
<% t.column "" do |forum_post_vote| %>
<% if forum_post_vote.creator == CurrentUser.user %>
<%= link_to "unvote", forum_post_vote_path(forum_post_vote, format: "js"), remote: true, method: :delete %>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<%= numbered_paginator(@forum_post_votes) %>
</div>

View File

@@ -1,29 +1,20 @@
<div id="c-forum-posts">
<div id="a-index">
<table width="100%" class="striped">
<thead>
<tr>
<th>Topic</th>
<th>Excerpt</th>
<th>Creator</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<% @forum_posts.each do |forum_post| %>
<% if CurrentUser.is_moderator? || !forum_post.is_deleted? %>
<tr id="forum-post-<%= forum_post.id %>" data-topic-is-deleted="<%= forum_post.topic.is_deleted? %>" data-is-deleted="<%= forum_post.is_deleted? %>">
<td class="forum-post-topic-title"><%= link_to forum_post.topic.title, forum_topic_path(forum_post.topic) %></td>
<td class="forum-post-excerpt">
<%= link_to truncate(forum_post.body, :length => 50), forum_post_path(forum_post) %>
</td>
<td><%= link_to_user forum_post.creator %></td>
<td><%= time_ago_in_words_tagged forum_post.created_at %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<%= table_for @forum_posts, {class: "striped", width: "100%"} do |t| %>
<% t.column "Topic", nil, {class: "forum-post-topic-title"} do |forum_post| %>
<%= link_to forum_post.topic.title, forum_topic_path(forum_post.topic) %>
<% end %>
<% t.column "Excerpt", nil, {class: "forum-post-excerpt"} do |forum_post| %>
<%= link_to truncate(forum_post.body, :length => 50), forum_post_path(forum_post) %>
<% end %>
<% t.column "Creator" do |forum_post| %>
<%= link_to_user forum_post.creator %>
<% end %>
<% t.column "Date" do |forum_post| %>
<%= time_ago_in_words_tagged forum_post.created_at %>
<% end %>
<% end %>
<%= numbered_paginator(@forum_posts) %>
</div>

View File

@@ -1,47 +1,37 @@
<table width="100%" class="striped">
<thead>
<tr>
<th>Title</th>
<th>Creator</th>
<th class="updater">Updated by</th>
<th class="updated-at">Updated at</th>
</tr>
</thead>
<tbody>
<% forum_topics.each do |topic| %>
<% if CurrentUser.user.level >= topic.min_level %>
<tr class="forum-topic-row forum-topic-category-<%= topic.category_id %>">
<td>
<% if topic.is_sticky? %>
<span class="sticky">Sticky:</span>
<% end %>
<% unless topic.read_by?(CurrentUser.user) %>
<span class="new">NEW</span>
<% end %>
<%= link_to topic.title, forum_topic_path(topic), class: "forum-post-link" %>
<% if topic.response_count > Danbooru.config.posts_per_page %>
<%= link_to "page #{topic.last_page}", forum_topic_path(topic, :page => topic.last_page), :class => "last-page" %>
<% end %>
<% if topic.is_locked? %>
<span class="locked-topic">(locked)</span>
<% end %>
<% if topic.min_level > 0 %>
<span class="level-topic">(<%= User.level_string(topic.min_level).downcase %> only)</span>
<% end %>
</td>
<td><%= link_to_user topic.creator %></td>
<td class="updater"><%= link_to_user topic.updater %></td>
<td class="updated-at"><%= compact_time topic.updated_at %></td>
</tr>
<% end %>
<%= table_for forum_topics, {class: "striped", width: "100%"} do |t| %>
<% t.column "Title" do |topic| %>
<% if topic.is_sticky? %>
<span class="sticky">Sticky:</span>
<% end %>
</tbody>
</table>
<% unless topic.read_by?(CurrentUser.user) %>
<span class="new">NEW</span>
<% end %>
<%= link_to topic.title, forum_topic_path(topic), class: "forum-post-link" %>
<% if topic.response_count > Danbooru.config.posts_per_page %>
<%= link_to "page #{topic.last_page}", forum_topic_path(topic, :page => topic.last_page), :class => "last-page" %>
<% end %>
<% if topic.is_locked? %>
<span class="locked-topic">(locked)</span>
<% end %>
<% if topic.min_level > 0 %>
<span class="level-topic">(<%= User.level_string(topic.min_level).downcase %> only)</span>
<% end %>
<% end %>
<% t.column "Creator" do |topic| %>
<%= link_to_user topic.creator %>
<% end %>
<% t.column "Updated by", {class: "updater"} do |topic| %>
<%= link_to_user topic.updater %>
<% end %>
<% t.column "Updated at", {class: "updated-at"} do |topic| %>
<%= compact_time topic.updated_at %>
<% end %>
<% end %>
<% content_for(:html_header) do %>
<style>

View File

@@ -1,32 +1,24 @@
<table class="striped autofit">
<thead>
<tr>
<th>Source</th>
<th>ID</th>
<th>IP Address</th>
<th>User</th>
<th>Date</th>
<th></th>
</tr>
</thead>
<tbody>
<% @ip_addresses.each do |ip| %>
<tr>
<td><%= link_to ip.model_type.underscore.humanize, ip_addresses_path(search: { model_type: ip.model_type }) %></td>
<td><%= link_to "##{ip.model_id}", ip.model %></td>
<td>
<%= link_to ip.ip_addr, ip_addresses_path(search: { ip_addr: ip.ip_addr }) %>
<%= link_to "»", ip_addresses_path(search: { ip_addr: ip.ip_addr, group_by: "user" }) %>
</td>
<td>
<%= link_to_user ip.user %>
<%= link_to "»", ip_addresses_path(search: { user_id: ip.user_id, group_by: "ip_addr" }) %>
</td>
<td><%= time_ago_in_words_tagged ip.created_at %></td>
<td><%= link_to "IP info", "https://ipinfo.io/#{ip.ip_addr}" %></td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @ip_addresses, {class: "striped autofit"} do |t| %>
<% t.column "Source" do |ip| %>
<%= link_to ip.model_type.underscore.humanize, ip_addresses_path(search: { model_type: ip.model_type }) %>
<% end %>
<% t.column "ID" do |ip| %>
<%= link_to "##{ip.model_id}", ip.model %>
<% end %>
<% t.column "IP Address" do |ip| %>
<%= link_to ip.ip_addr, ip_addresses_path(search: { ip_addr: ip.ip_addr }) %>
<%= link_to "»", ip_addresses_path(search: { ip_addr: ip.ip_addr, group_by: "user" }) %>
<% end %>
<% t.column "User" do |ip| %>
<%= link_to_user ip.user %>
<%= link_to "»", ip_addresses_path(search: { user_id: ip.user_id, group_by: "ip_addr" }) %>
<% end %>
<% t.column "Date" do |ip| %>
<%= time_ago_in_words_tagged ip.created_at %>
<% end %>
<% t.column "" do |ip| %>
<%= link_to "IP info", "https://ipinfo.io/#{ip.ip_addr}" %>
<% end %>
<% end %>
<%= numbered_paginator(@ip_addresses) %>

View File

@@ -2,24 +2,15 @@
<%= link_to "Find all users associated with the top 10 IP addresses", ip_addresses_path(search: { ip_addr: @ip_addresses.map(&:to_s).take(10).join(" "), group_by: "user" }) %>
</p>
<table class="striped autofit">
<thead>
<tr>
<th>IP Address</th>
<th>Uses</th>
<th></th>
</tr>
</thead>
<tbody>
<% @ip_addresses.each do |ip| %>
<tr>
<td>
<%= link_to ip.to_s, ip_addresses_path(search: { ip_addr: ip.to_s }) %>
<%= link_to "»", ip_addresses_path(search: { ip_addr: ip.to_s, group_by: "user" }) %>
</td>
<td><%= link_to ip.count_all, ip_addresses_path(search: { ip_addr: ip.to_s }) %></td>
<td><%= link_to "IP info", "https://ipinfo.io/#{ip.ip_addr}" %></td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @ip_addresses, {class: "striped autofit"} do |t| %>
<% t.column "IP Address" do |ip| %>
<%= link_to ip.to_s, ip_addresses_path(search: { ip_addr: ip.to_s }) %>
<%= link_to "»", ip_addresses_path(search: { ip_addr: ip.to_s, group_by: "user" }) %>
<% end %>
<% t.column "Uses" do |ip| %>
<%= link_to ip.count_all, ip_addresses_path(search: { ip_addr: ip.to_s }) %>
<% end %>
<% t.column "" do |ip| %>
<%= link_to "IP info", "https://ipinfo.io/#{ip.ip_addr}" %>
<% end %>
<% end %>

View File

@@ -2,22 +2,13 @@
<%= link_to "Find all IP addresses associated with these users", ip_addresses_path(search: { user_id: @ip_addresses.map(&:user_id).join(" "), group_by: "ip_addr" }) %>
</p>
<table class="striped autofit">
<thead>
<tr>
<th>User</th>
<th>Uses</th>
</tr>
</thead>
<tbody>
<% @ip_addresses.each do |ip| %>
<tr>
<td>
<%= link_to_user ip.user %>
<%= link_to "»", ip_addresses_path(search: { user_id: ip.user_id, group_by: "ip_addr" }) %>
</td>
<td><%= link_to ip.count_all, ip_addresses_path(search: { user_id: ip.user_id, ip_addr: params[:search][:ip_addr] }) %></td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @ip_addresses, {class: "striped autofit"} do |t| %>
<% t.column "User" do |ip| %>
<%= link_to_user ip.user %>
<%= link_to "»", ip_addresses_path(search: { user_id: ip.user_id, group_by: "ip_addr" }) %>
<% end %>
<% t.column "Uses" do |ip| %>
<%= link_to ip.count_all, ip_addresses_path(search: { user_id: ip.user_id, ip_addr: params[:search][:ip_addr] }) %>
<% end %>
<% end %>

View File

@@ -2,26 +2,18 @@
<div id="a-index">
<h1>IP Bans</h1>
<table class="striped" width="100%">
<thead>
<tr>
<th>IP Address</th>
<th>Banner</th>
<th>Reason</th>
<th></th>
</tr>
</thead>
<tbody>
<% @ip_bans.each do |ip_ban| %>
<tr>
<td><%= link_to_ip ip_ban.subnetted_ip %></td>
<td><%= link_to_user ip_ban.creator %></td>
<td><%= ip_ban.reason %></td>
<td><%= link_to "Unban", ip_ban_path(ip_ban), :remote => true, :method => :delete, :data => {:confirm => "Do your really want to unban #{ip_ban.ip_addr}?"} %></td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @ip_bans, {class: "striped", width: "100%"} do |t| %>
<% t.column "IP Address" do |ip_ban| %>
<%= link_to_ip ip_ban.subnetted_ip %>
<% end %>
<% t.column "Banner" do |ip_ban| %>
<%= link_to_user ip_ban.creator %>
<% end %>
<% t.column :reason %>
<% t.column "" do |ip_ban| %>
<%= link_to "Unban", ip_ban_path(ip_ban), :remote => true, :method => :delete, :data => {:confirm => "Do your really want to unban #{ip_ban.ip_addr}?"} %>
<% end %>
<% end %>
<%= numbered_paginator(@ip_bans) %>
</div>

View File

@@ -75,7 +75,7 @@
<%= yield :html_header %>
<%= raw Danbooru.config.custom_html_header_content %>
</head>
<%= tag.body **body_attributes(CurrentUser.user) do %>
<%= tag.body **body_attributes(CurrentUser.user, @current_item) do %>
<%= render "news_updates/listing" %>
<header id="top">

View File

@@ -4,34 +4,19 @@
<%= render "search" %>
<table class="striped autofit">
<thead>
<tr>
<th>Category</th>
<th>Message</th>
<th>Created</th>
</tr>
</thead>
<tbody>
<% @mod_actions.each do |mod_action| %>
<tr>
<td>
<%= link_to mod_action.category.humanize, mod_actions_path(search: { category: mod_action.category_id }) %>
</td>
<td class="col-expand">
<div class="prose">
<%= format_text(mod_action.description) %>
</div>
</td>
<td>
<%= link_to_user mod_action.creator %>
<%= link_to "»", mod_actions_path(search: { creator_name: mod_action.creator.name }) %>
<div><%= time_ago_in_words_tagged(mod_action.created_at) %></div>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @mod_actions, {class: "striped autofit"} do |t| %>
<% t.column "Category" do |mod_action| %>
<%= link_to mod_action.category.humanize, mod_actions_path(search: { category: mod_action.category_id }) %>
<% end %>
<% t.column "Message", nil, {class: "col-expand"} do |mod_action| %>
<%= format_text(mod_action.description) %>
<% end %>
<% t.column "Created" do |mod_action| %>
<%= link_to_user mod_action.creator %>
<%= link_to "»", mod_actions_path(search: { creator_name: mod_action.creator.name }) %>
<div><%= time_ago_in_words_tagged(mod_action.created_at) %></div>
<% end %>
<% end %>
<%= numbered_paginator(@mod_actions) %>
</div>

View File

@@ -13,41 +13,27 @@
<%= f.submit "Search" %>
<% end %>
<table class="striped autofit" width="100%">
<thead>
<tr>
<th>Post</th>
<th>Message</th>
<th>Reason</th>
<th>Created</th>
</tr>
</thead>
<tbody>
<% @post_disapprovals.each do |post_disapproval| %>
<tr>
<td>
<%= link_to "post ##{post_disapproval.post_id}", post_path(post_disapproval.post_id) %>
<%= link_to "»", moderator_post_disapprovals_path(search: params[:search].merge(post_id: post_disapproval.post_id)) %>
</td>
<td class="col-expand">
<div class="prose">
<%= format_text(post_disapproval.message) %>
</div>
</td>
<td>
<%= link_to post_disapproval.reason.humanize, moderator_post_disapprovals_path(search: params[:search].merge(reason: post_disapproval.reason)) %>
</td>
<td>
<%= link_to_user post_disapproval.user %>
<%= link_to "»", moderator_post_disapprovals_path(search: params[:search].merge(creator_name: post_disapproval.user&.name)) %>
<p>
<%= compact_time(post_disapproval.updated_at) %>
</p>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @post_disapprovals, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Post" do |post_disapproval| %>
<%= link_to "post ##{post_disapproval.post_id}", post_path(post_disapproval.post_id) %>
<%= link_to "»", moderator_post_disapprovals_path(search: params[:search].merge(post_id: post_disapproval.post_id)) %>
<% end %>
<% t.column "Message", nil, {class: "col-expand"} do |post_disapproval| %>
<div class="prose">
<%= format_text(post_disapproval.message) %>
</div>
<% end %>
<% t.column "Reason" do |post_disapproval| %>
<%= link_to post_disapproval.reason.humanize, moderator_post_disapprovals_path(search: params[:search].merge(reason: post_disapproval.reason)) %>
<% end %>
<% t.column "Created" do |post_disapproval| %>
<%= link_to_user post_disapproval.user %>
<%= link_to "»", moderator_post_disapprovals_path(search: params[:search].merge(creator_name: post_disapproval.user&.name)) %>
<p>
<%= compact_time(post_disapproval.updated_at) %>
</p>
<% end %>
<% end %>
<%= numbered_paginator(@post_disapprovals) %>
</div>

View File

@@ -2,24 +2,16 @@
<div id="a-index">
<h1>News Updates</h1>
<table class="striped" width="100%">
<thead>
<tr>
<th>Creator</th>
<th>Message</th>
<th></th>
</tr>
</thead>
<tbody>
<% @news_updates.each do |news_update| %>
<tr id="news-update-<%= news_update.id %>">
<td><%= link_to_user news_update.creator %></td>
<td><%= news_update.message %></td>
<td><%= link_to "Edit", edit_news_update_path(news_update) %> | <%= link_to "Delete", news_update_path(news_update), :method => :delete %></td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @news_updates, {class: "striped", width: "100%"} do |t| %>
<% t.column "Creator" do |news_update| %>
<%= link_to_user news_update.creator %>
<% end %>
<% t.column :message %>
<% t.column "" do |news_update| %>
<%= link_to "Edit", edit_news_update_path(news_update) %>
| <%= link_to "Delete", news_update_path(news_update), :method => :delete %>
<% end %>
<% end %>
<%= numbered_paginator(@news_updates) %>
</div>

View File

@@ -0,0 +1,45 @@
<div id="p-<%= note_versions_listing_type %>-listing">
<%= table_for @note_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column %>
<% t.column "Post", {width: "5%"} do |note_version| %>
<%= link_to note_version.post_id, post_path(note_version.post_id) %>
<% if params.dig(:search, :note_id).present? %>
<%= link_to "»", note_versions_path(search: {post_id: note_version.post_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, :post_id).present? %>
<%= link_to "»", note_versions_path(search: {note_id: note_version.note_id}) %>
<% end %>
<% end %>
<% t.column "Body", nil, {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) %>
<% end %>
<% t.column "Position", {width: "5%"} do |note_version| %>
<%= note_version_position_diff(note_version) %>
<% end %>
<% if CurrentUser.is_moderator? %>
<% t.column "IP Address", {width: "10%"} do |note_version| %>
<%= link_to_ip note_version.updater_ip_addr %>
<% end %>
<% end %>
<% t.column "Edited By", {width: "10%"} do |note_version| %>
<%= link_to_user note_version.updater %>
<% end %>
<% t.column "Date", {width: "10%"} do |note_version| %>
<%= compact_time note_version.updated_at %>
<% end %>
<% if note_versions_listing_type == :revert %>
<% t.column "", {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 %>
<% end %>
<% end %>
</div>

View File

@@ -1,62 +0,0 @@
<div id="p-revert-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th></th>
<th width="5%">Post</th>
<th width="5%">Note</th>
<th>Body</th>
<th width="5%">Position</th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="10%">Edited By</th>
<th width="10%">Date</th>
<% if CurrentUser.is_member? %>
<th width="7%"></th>
<% end %>
</tr>
</thead>
<tbody>
<% @note_versions.each do |note_version| %>
<tr>
<td></td>
<td>
<%= link_to note_version.post_id, post_path(note_version.post_id) %>
<% if params.dig(:search, :note_id).present? %>
<%= link_to "»", note_versions_path(search: {post_id: note_version.post_id}) %>
<% end %>
</td>
<td>
<%= 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, :post_id).present? %>
<%= link_to "»", note_versions_path(search: {note_id: note_version.note_id}) %>
<% end %>
</td>
<td class="col-expand">
<%= h(note_version.body) %>
<% unless note_version.is_active? %>
<span class="inactive">(deleted)</span>
<% end %>
<%= note_version_body_diff_info(note_version) %>
</td>
<td>
<%= note_version_position_diff(note_version) %>
</td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip note_version.updater_ip_addr %>
</td>
<% end %>
<td><%= link_to_user note_version.updater %></td>
<td><%= compact_time note_version.updated_at %></td>
<% if CurrentUser.is_member? %>
<td>
<%= 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?"} %>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -1,50 +0,0 @@
<div id="p-standard-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th></th>
<th width="5%">Post</th>
<th width="5%">Note</th>
<th>Body</th>
<th width="5%">Position</th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="10%">Edited By</th>
<th width="10%">Date</th>
</tr>
</thead>
<tbody>
<% @note_versions.each do |note_version| %>
<tr id="note-version-<%= note_version.id%>">
<td></td>
<td>
<%= link_to note_version.post_id, post_path(note_version.post_id) %>
<%= link_to "»", note_versions_path(search: {post_id: note_version.post_id}) %>
</td>
<td>
<%= link_to "#{note_version.note_id}.#{note_version.version}", post_path(note_version.post_id, anchor: "note-#{note_version.note_id}") %>
<%= link_to "»", note_versions_path(search: {note_id: note_version.note_id}) %>
</td>
<td class="col-expand">
<%= h(note_version.body) %>
<% unless note_version.is_active? %>
<span class="inactive">(deleted)</span>
<% end %>
<%= note_version_body_diff_info(note_version) %>
</td>
<td>
<%= note_version_position_diff(note_version) %>
</td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip note_version.updater_ip_addr %>
</td>
<% end %>
<td><%= link_to_user note_version.updater %></td>
<td><%= compact_time note_version.updated_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -2,14 +2,11 @@
<div id="a-index">
<h1>Note Changes</h1>
<% if params.dig(:search, :post_id).present? || params.dig(:search, :note_id).present? %>
<%= render "revert_listing" %>
<% else %>
<%= render "standard_listing" %>
<% end %>
<%= render "listing" %>
<%= numbered_paginator(@note_versions) %>
<%= render "notes/secondary_links" %>
</div>
</div>
<%= render "notes/secondary_links" %>

View File

@@ -2,7 +2,7 @@
<div id="a-index">
<h1>Notes</h1>
<%= table_for @notes, class: "striped autofit" do |t| %>
<%= table_for @notes, {class: "striped autofit"} do |t| %>
<% t.column "Post" do |note| %>
<%= link_to note.post_id, note.post %>
<% end %>

View File

@@ -0,0 +1,38 @@
<div id="p-<%= pool_versions_listing_type %>-listing">
<%= table_for @pool_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% 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}" %>
<% end %>
<% t.column "Changes", class: "col-expand" do |pool_version| %>
<%= render "pool_versions/diff", diff: pool_version.build_diff %>
<% end %>
<% 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 "Desc Chg" do |pool_version| %>
<%= link_to_if pool_version.description_changed, pool_version.description_changed, diff_pool_version_path(pool_version.id) %>
<% 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 %>
<% end %>
<% if CurrentUser.is_moderator? %>
<% t.column "IP Address" do |pool_version| %>
<%= link_to_ip pool_version.updater_ip_addr %>
<% end %>
<% end %>
<% t.column "Date" do |pool_version| %>
<%= compact_time pool_version.updated_at %>
<% end %>
<% if pool_versions_listing_type == :revert %>
<% t.column "" do |pool_version| %>
<%= link_to "Revert to", revert_pool_path(pool_version.pool_id, :version_id => pool_version.id), :method => :put, :remote => true %>
<% end %>
<% end %>
<% end %>
</div>

View File

@@ -1,50 +0,0 @@
<div id="p-revert-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th>Pool</th>
<th>Changes</th>
<th>Post Count</th>
<th>Desc Chg</th>
<th>Updater</th>
<% if CurrentUser.is_moderator? %>
<th>IP Address</th>
<% end %>
<th>Date</th>
<% if CurrentUser.is_member? %>
<th></th>
<% end %>
</tr>
</thead>
<tbody>
<% @pool_versions.each do |pool_version| %>
<tr>
<td>
<%= 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}" %>
</td>
<td class="col-expand"><%= render "pool_versions/diff", diff: pool_version.build_diff %></td>
<td><%= link_to pool_version.post_ids.size, pool_versions_path(search: { pool_id: pool_version.pool_id }) %></td>
<td><%= link_to_if pool_version.description_changed, pool_version.description_changed, diff_pool_version_path(pool_version.id) %></td>
<td>
<% if pool_version.updater %>
<%= link_to_user pool_version.updater %>
<%= link_to "»", pool_versions_path(search: { updater_id: pool_version.updater_id }) %>
<% end %>
</td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip pool_version.updater_ip_addr %>
</td>
<% end %>
<td><%= compact_time pool_version.updated_at %></td>
<% if CurrentUser.is_member? %>
<td>
<%= link_to "Revert to", revert_pool_path(pool_version.pool_id, :version_id => pool_version.id), :method => :put, :remote => true %>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -1,42 +0,0 @@
<div id="p-standard-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th>Pool</th>
<th>Changes</th>
<th>Post Count</th>
<th>Desc Chg</th>
<th>Updater</th>
<% if CurrentUser.is_moderator? %>
<th>IP Address</th>
<% end %>
<th>Date</th>
</tr>
</thead>
<tbody>
<% @pool_versions.each do |pool_version| %>
<tr id="pool-version-<%= pool_version.id %>">
<td>
<%= 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}" %>
</td>
<td class="col-expand"><%= render "pool_versions/diff", diff: pool_version.build_diff %></td>
<td><%= link_to pool_version.post_ids.size, pool_versions_path(search: { pool_id: pool_version.pool_id }) %></td>
<td><%= link_to_if pool_version.description_changed, pool_version.description_changed, diff_pool_version_path(pool_version.id) %></td>
<td>
<% if pool_version.updater %>
<%= link_to_user pool_version.updater %>
<%= link_to "»", pool_versions_path(search: { updater_id: pool_version.updater_id }) %>
<% end %>
</td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip pool_version.updater_ip_addr %>
</td>
<% end %>
<td><%= compact_time pool_version.updated_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -2,11 +2,7 @@
<div id="a-index">
<h1>Pool History</h1>
<% if params.dig(:search, :pool_id).present? %>
<%= render "revert_listing" %>
<% else %>
<%= render "standard_listing" %>
<% end %>
<%= render "listing" %>
<%= numbered_paginator(@pool_versions) %>
</div>

Some files were not shown because too many files have changed in this diff Show More