Convert index tables to using table builder

This commit is contained in:
BrokenEagle
2020-01-03 06:19:30 +00:00
parent 917ffa87ed
commit 043944e1dd
47 changed files with 1161 additions and 1628 deletions

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,30 +1,35 @@
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, :row_attributes, :items
def initialize(items, **html_attributes)
def initialize(items, table_attributes=nil, row_attributes=nil)
@items = items
@columns = []
@html_attributes = html_attributes
@table_attributes = table_attributes
@row_attributes = row_attributes
yield self if block_given?
end
@@ -32,7 +37,22 @@ 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 !row_attributes.nil?
mapped_row_attributes = row_attributes.clone
mapped_row_attributes.clone.each do |key, value|
if value.kind_of?(Array)
mapped_row_attributes[key] = value[0] % value.slice(1,value.length).map {|param| eval(param)}
end
end
else
mapped_row_attributes = {}
end
standard_attributes.merge(mapped_row_attributes)
end
end

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

@@ -1,46 +1,33 @@
<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>
<%= table_for @commentary_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Post", {width: "5%"} do |commentary_version| %>
<%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %>
<% 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 %>
</tbody>
</table>
<% 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 CurrentUser.is_member? %>
<% 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,40 +1,31 @@
<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>
<%= table_for @commentary_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Post", {width: "5%"} do |commentary_version| %>
<%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %>
<% end %>
<% 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 %>
<% 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 %>
</tbody>
</table>
<% 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 %>
<% end %>
</div>

View File

@@ -1,55 +1,43 @@
<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>
<%= 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 %>
</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>
<% 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

@@ -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"}, {"data-expired": ["%s", "item.expired?"]} 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%"}, {class: ["read-%s", "item.is_read?"]} 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%"}, {"data-is-deleted": ["%s", "item.is_deleted?"], "data-topic-is-deleted": ["%s", "item.topic.is_deleted?"]} 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

@@ -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

@@ -1,62 +1,45 @@
<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>
<%= 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 %>
<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>
<% 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 CurrentUser.is_member? %>
<% 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,50 +1,40 @@
<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>
<%= 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 %>
<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>
<% 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 %>
<% end %>
</div>

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

@@ -1,50 +1,38 @@
<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>
<%= 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 %>
</tbody>
</table>
<% 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 CurrentUser.is_member? %>
<% 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,42 +1,33 @@
<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>
<%= 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 %>
</tbody>
</table>
<% 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 %>
<% end %>
</div>

View File

@@ -1,37 +1,22 @@
<div id="c-pools">
<div id="a-index">
<%= render "search", :path => pools_path %>
<table class="striped" width="100%">
<thead>
<tr>
<th width="5%"></th>
<th width="60%">Name</th>
<th width="10%">Count</th>
</tr>
</thead>
<tbody>
<% @pools.each do |pool| %>
<%= content_tag(:tr, :id => "pool-#{pool.id}", :class => "pool-category-#{pool.category}") do %>
<td>
</td>
<td>
<%= link_to pool.pretty_name, pool_path(pool) %>
<% if pool.is_deleted? %>
<span class="inactive">(deleted)</span>
<% end %>
<% if pool.last_page > 1 %>
<%= link_to "page #{pool.last_page}", pool_path(pool, :page => pool.last_page), :class => "last-page" %>
<% end %>
</td>
<td>
<%= pool.post_count %>
</td>
<% end %>
<%= table_for @pools, {class: "striped", width: "100%"} do |t| %>
<% t.column nil, {width: "5%"} %>
<% t.column "Name", {width: "60%"} do |pool| %>
<span class="pool-category-<%= pool.category %>"><%= link_to pool.pretty_name, pool_path(pool) %></span>
<% if pool.is_deleted? %>
<span class="inactive">(deleted)</span>
<% end %>
</tbody>
</table>
<% if pool.last_page > 1 %>
<%= link_to "page #{pool.last_page}", pool_path(pool, :page => pool.last_page), :class => "last-page" %>
<% end %>
<% end %>
<% t.column "Count", {width: "10%"} do |pool| %>
<%= pool.post_count %>
<% end %>
<% end %>
<%= numbered_paginator(@pools) %>
</div>

View File

@@ -3,56 +3,42 @@
<h1>Appeals</h1>
<%= render "search" %>
<%= render "posts/partials/common/inline_blacklist" %>
<table width="100%" class="striped">
<thead>
<tr>
<th width="1%">Post</th>
<th>Reason</th>
<th width="1%">Appeals</th>
<th width="5%">Resolved?</th>
<th width="15%">Uploaded</th>
<th width="15%">Appealed</th>
<th width="15%">Approver</th>
</tr>
</thead>
<tbody>
<% @post_appeals.each do |post_appeal| %>
<tr>
<td><%= PostPresenter.preview(post_appeal.post, :tags => "status:any") %></td>
<td>
<span class="prose">
<%= format_text post_appeal.reason, inline: true %>
</span>
</td>
<td>
<%= link_to post_appeal.post.appeals.size, post_appeals_path(search: { post_id: post_appeal.post_id }) %>
</td>
<td>
<%= link_to post_appeal.is_resolved.to_s, post_appeals_path(search: params[:search].merge(is_resolved: post_appeal.is_resolved)) %>
</td>
<td>
<%= compact_time post_appeal.post.created_at %>
<br> by <%= link_to_user post_appeal.post.uploader %>
<%= link_to "»", post_appeals_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} user:#{post_appeal.post.uploader.name}".strip)) %>
</td>
<td>
<%= compact_time post_appeal.created_at %>
<br> by <%= link_to_user post_appeal.creator %>
<%= link_to "»", post_appeals_path(search: params[:search].merge(creator_name: post_appeal.creator.name)) %>
</td>
<td>
<% if post_appeal.post.approver %>
<%= link_to_user post_appeal.post.approver %>
<%= link_to "»", post_appeals_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:#{post_appeal.post.approver.name}".strip)) %>
<% else %>
<em>none</em>
<%= link_to "»", post_appeals_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:none".strip)) %>
<% end %>
</td>
</tr>
<%= table_for @post_appeals, {class: "striped", width: "100%"} do |t| %>
<% t.column "Post", {width: "1%"} do |post_appeal| %>
<%= PostPresenter.preview(post_appeal.post, :tags => "status:any") %>
<% end %>
<% t.column "Reason" do |post_appeal| %>
<span class="prose">
<%= format_text post_appeal.reason, inline: true %>
</span>
<% end %>
<% t.column "Appeals", {width: "1%"} do |post_appeal| %>
<%= link_to post_appeal.post.appeals.size, post_appeals_path(search: { post_id: post_appeal.post_id }) %>
<% end %>
<% t.column "Resolved?", {width: "5%"} do |post_appeal| %>
<%= link_to post_appeal.is_resolved.to_s, post_appeals_path(search: params[:search].merge(is_resolved: post_appeal.is_resolved)) %>
<% end %>
<% t.column "Uploaded", {width: "15%"} do |post_appeal| %>
<%= compact_time post_appeal.post.created_at %>
<br> by <%= link_to_user post_appeal.post.uploader %>
<%= link_to "»", post_appeals_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} user:#{post_appeal.post.uploader.name}".strip)) %>
<% end %>
<% t.column "Appealed", {width: "15%"} do |post_appeal| %>
<%= compact_time post_appeal.created_at %>
<br> by <%= link_to_user post_appeal.creator %>
<%= link_to "»", post_appeals_path(search: params[:search].merge(creator_name: post_appeal.creator.name)) %>
<% end %>
<% t.column "Approver", {width: "15%"} do |post_appeal| %>
<% if post_appeal.post.approver %>
<%= link_to_user post_appeal.post.approver %>
<%= link_to "»", post_appeals_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:#{post_appeal.post.approver.name}".strip)) %>
<% else %>
<em>none</em>
<%= link_to "»", post_appeals_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:none".strip)) %>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<%= numbered_paginator(@post_appeals) %>
</div>

View File

@@ -9,29 +9,16 @@
<%= f.submit "Search" %>
<% end %>
<table width="100%" class="striped">
<thead>
<tr>
<th width="1%">Post</th>
<th width="15%">Approver</th>
</tr>
</thead>
<tbody>
<% @post_approvals.each do |post_approval| %>
<tr>
<td>
<%= PostPresenter.preview(post_approval.post, :tags => "status:any") %>
</td>
<td>
<%= link_to_user post_approval.user %>
<%= link_to "»", post_approvals_path(search: params[:search].merge(user_name: post_approval.user.name)) %>
<br><%= time_ago_in_words_tagged post_approval.created_at %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @post_approvals, {class: "striped", width: "100%"} do |t| %>
<% t.column "Post", {width: "1%"} do |post_approval| %>
<%= PostPresenter.preview(post_approval.post, :tags => "status:any") %>
<% end %>
<% t.column "Approver", {width: "15%"} do |post_approval| %>
<%= link_to_user post_approval.user %>
<%= link_to "»", post_approvals_path(search: params[:search].merge(user_name: post_approval.user.name)) %>
<br><%= time_ago_in_words_tagged post_approval.created_at %>
<% end %>
<% end %>
<%= numbered_paginator(@post_approvals) %>
</div>

View File

@@ -3,62 +3,47 @@
<h1>Flags</h1>
<%= render "search" %>
<%= render "posts/partials/common/inline_blacklist" %>
<table width="100%" class="striped">
<thead>
<tr>
<th width="1%">Post</th>
<th>Reason</th>
<th width="1%">Flags</th>
<th width="1%">Category</th>
<th width="1%">Resolved?</th>
<th width="15%">Uploaded</th>
<th width="15%">Flagged</th>
<th width="15%">Approver</th>
</tr>
</thead>
<tbody>
<% @post_flags.each do |post_flag| %>
<tr class="resolved-<%= post_flag.is_resolved? %>">
<td><%= PostPresenter.preview(post_flag.post, :tags => "status:any") %></td>
<td>
<span class="prose">
<%= format_text post_flag.reason, inline: true %>
</span>
</td>
<td>
<%= link_to post_flag.post.flags.size, post_flags_path(search: { post_id: post_flag.post_id }) %>
</td>
<td>
<%= link_to post_flag.category.to_s, post_flags_path(search: params[:search].merge(category: post_flag.category)) %>
</td>
<td>
<%= link_to post_flag.is_resolved?.to_s, post_flags_path(search: params[:search].merge(is_resolved: post_flag.is_resolved?)) %>
</td>
<td>
<%= compact_time post_flag.post.created_at %>
<br> by <%= link_to_user post_flag.post.uploader %>
<%= link_to "»", post_flags_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} user:#{post_flag.post.uploader.name}".strip)) %>
</td>
<td>
<%= compact_time post_flag.created_at %>
<% if CurrentUser.can_view_flagger_on_post?(post_flag) %>
<br> by <%= link_to_user post_flag.creator %>
<%= link_to "»", post_flags_path(search: params[:search].merge(creator_name: post_flag.creator.name)) %>
<% end %>
</td>
<td>
<% if post_flag.post.approver %>
<%= link_to_user post_flag.post.approver %>
<%= link_to "»", post_flags_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:#{post_flag.post.approver.name}".strip)) %>
<% else %>
<em>none</em>
<%= link_to "»", post_flags_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:none".strip)) %>
<% end %>
</td>
</tr>
<%= table_for @post_flags, {class: "striped", width: "100%"}, {class: ["resolved-%s", "item.is_resolved?"]} do |t| %>
<% t.column "Post", {width: "1%"} do |post_flag| %>
<%= PostPresenter.preview(post_flag.post, :tags => "status:any") %>
<% end %>
<% t.column "Reason" do |post_flag| %>
<span class="prose">
<%= format_text post_flag.reason, inline: true %>
</span>
<% end %>
<% t.column "Flags", {width: "1%"} do |post_flag| %>
<%= link_to post_flag.post.flags.size, post_flags_path(search: { post_id: post_flag.post_id }) %>
<% end %>
<% t.column "Category", {width: "1%"} do |post_flag| %>
<%= link_to post_flag.category.to_s, post_flags_path(search: params[:search].merge(category: post_flag.category)) %>
<% end %>
<% t.column "Resolved?", {width: "1%"} do |post_flag| %>
<%= link_to post_flag.is_resolved?.to_s, post_flags_path(search: params[:search].merge(is_resolved: post_flag.is_resolved?)) %>
<% end %>
<% t.column "Uploaded", {width: "15%"} do |post_flag| %>
<%= compact_time post_flag.post.created_at %>
<br> by <%= link_to_user post_flag.post.uploader %>
<%= link_to "»", post_flags_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} user:#{post_flag.post.uploader.name}".strip)) %>
<% end %>
<% t.column "Flagged", {width: "15%"} do |post_flag| %>
<%= compact_time post_flag.created_at %>
<% if CurrentUser.can_view_flagger_on_post?(post_flag) %>
<br> by <%= link_to_user post_flag.creator %>
<%= link_to "»", post_flags_path(search: params[:search].merge(creator_name: post_flag.creator.name)) %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Approver", {width: "15%"} do |post_flag| %>
<% if post_flag.post.approver %>
<%= link_to_user post_flag.post.approver %>
<%= link_to "»", post_flags_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:#{post_flag.post.approver.name}".strip)) %>
<% else %>
<em>none</em>
<%= link_to "»", post_flags_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:none".strip)) %>
<% end %>
<% end %>
<% end %>
<%= numbered_paginator(@post_flags) %>
</div>

View File

@@ -10,74 +10,58 @@
<%= f.submit "Search" %>
<% end %>
<table width="100%" class="striped autofit">
<thead>
<tr>
<th width="1%">Post</th>
<th>Source</th>
<th>MD5</th>
<th>Size</th>
<th>Replacer</th>
</tr>
</thead>
<tbody>
<% @post_replacements.each do |post_replacement| %>
<tr>
<td><%= PostPresenter.preview(post_replacement.post, show_deleted: true) %></td>
<td>
<dl>
<dt>Original Source</dt>
<dd><%= external_link_to post_replacement.original_url, truncate: 64 %></dd>
<dt>Replacement Source</dt>
<dd>
<% if post_replacement.replacement_url.present? %>
<%= external_link_to post_replacement.replacement_url, truncate: 64 %>
<% else %>
<em>file</em>
<% end %>
</dd>
</dl>
</td>
<%= table_for @post_replacements, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Post", {width: "1%"} do |post_replacement| %>
<%= PostPresenter.preview(post_replacement.post, show_deleted: true) %>
<% end %>
<% t.column "Source" do |post_replacement| %>
<dl>
<dt>Original Source</dt>
<dd><%= external_link_to post_replacement.original_url, truncate: 64 %></dd>
<dt>Replacement Source</dt>
<dd>
<% if post_replacement.replacement_url.present? %>
<%= external_link_to post_replacement.replacement_url, truncate: 64 %>
<% else %>
<em>file</em>
<% end %>
</dd>
</dl>
<% end %>
<% t.column "MD5" do |post_replacement| %>
<% if post_replacement.md5_was.present? && post_replacement.md5.present? %>
<dl>
<dt>Original MD5</dt>
<dd><%= post_replacement.md5_was %></dd>
<td>
<% if post_replacement.md5_was.present? && post_replacement.md5.present? %>
<dl>
<dt>Original MD5</dt>
<dd><%= post_replacement.md5_was %></dd>
<dt>Replacement MD5</dt>
<dd><%= post_replacement.md5 %></dd>
</dl>
<% end %>
</td>
<td>
<% if %i[image_width_was image_height_was file_size_was file_ext_was image_width image_height file_size file_ext].all? { |k| post_replacement[k].present? } %>
<dl>
<dt>Original Size</dt>
<dd>
<%= post_replacement.image_width_was %>x<%= post_replacement.image_height_was %>
(<%= post_replacement.file_size_was.to_s(:human_size, precision: 4) %>, <%= post_replacement.file_ext_was %>)
</dd>
<dt>Replacement Size</dt>
<dd>
<%= post_replacement.image_width %>x<%= post_replacement.image_height %>
(<%= post_replacement.file_size.to_s(:human_size, precision: 4) %>, <%= post_replacement.file_ext %>)
</dd>
</dl>
<% end %>
</td>
<td>
<%= compact_time post_replacement.created_at %>
<br> by <%= link_to_user post_replacement.creator %>
<%= link_to "»", post_replacements_path(search: params[:search].merge(creator_name: post_replacement.creator.name)) %>
</td>
</tr>
<dt>Replacement MD5</dt>
<dd><%= post_replacement.md5 %></dd>
</dl>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Size" do |post_replacement| %>
<% if %i[image_width_was image_height_was file_size_was file_ext_was image_width image_height file_size file_ext].all? { |k| post_replacement[k].present? } %>
<dl>
<dt>Original Size</dt>
<dd>
<%= post_replacement.image_width_was %>x<%= post_replacement.image_height_was %>
(<%= post_replacement.file_size_was.to_s(:human_size, precision: 4) %>, <%= post_replacement.file_ext_was %>)
</dd>
<dt>Replacement Size</dt>
<dd>
<%= post_replacement.image_width %>x<%= post_replacement.image_height %>
(<%= post_replacement.file_size.to_s(:human_size, precision: 4) %>, <%= post_replacement.file_ext %>)
</dd>
</dl>
<% end %>
<% end %>
<% t.column "Replacer" do |post_replacement| %>
<%= compact_time post_replacement.created_at %>
<br> by <%= link_to_user post_replacement.creator %>
<%= link_to "»", post_replacements_path(search: params[:search].merge(creator_name: post_replacement.creator.name)) %>
<% end %>
<% end %>
<%= numbered_paginator(@post_replacements) %>
</div>

View File

@@ -3,58 +3,41 @@
<%= PostPresenter.preview(@post_versions.first.post, show_deleted: true) %>
<% end %>
<table id="post-versions-table" class="striped autofit">
<thead>
<tr>
<% if CurrentUser.user.is_builder? %>
<th class="post-version-select-column">
<label><input type="checkbox" id="post-version-select-all-checkbox" class="post-version-select-checkbox"></label>
</th>
<%= table_for @post_versions, {id: "post-versions-table", class: "striped autofit"} do |t| %>
<% if CurrentUser.user.is_builder? %>
<% t.column "<label><input type=\"checkbox\" id=\"post-version-select-all-checkbox\" class=\"post-version-select-checkbox\"></label>", {class: "post-version-select-column"}, nil, true do |post_version| %>
<input type="checkbox" class="post-version-select-checkbox" <%= "disabled" unless post_version.can_undo?(CurrentUser.user) %>>
<% end %>
<% if post_version_listing == :standard %>
<th>Post</th>
<% end %>
<th>Version</th>
<th>Tags</th>
<th>Updated</th>
<th></th>
</tr>
</thead>
<tbody>
<% @post_versions.each do |post_version| %>
<tr id="post-version-<%= post_version.id %>" data-post-version-id="<%= post_version.id %>">
<% if CurrentUser.user.is_builder? %>
<td class="post-version-select-column">
<input type="checkbox" class="post-version-select-checkbox" <%= "disabled" unless post_version.can_undo?(CurrentUser.user) %>>
</td>
<% end %>
<% if post_version_listing == :standard %>
<td><%= PostPresenter.preview(post_version.post, show_deleted: true) %></td>
<% end %>
<td>
<%= 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}") %>
</td>
<td class="col-expand"><%= post_version_diff(post_version) %></td>
<td>
<%= link_to_user post_version.updater %>
<%= link_to "»", post_versions_path(search: params[:search].merge({ updater_name: post_version.updater&.name })) %>
<div>
<%= compact_time(post_version.updated_at) %>
<% if CurrentUser.is_moderator? %>
(<%= link_to_ip post_version.updater_ip_addr %>)
<% end %>
</div>
</td>
<td>
<% 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_version_listing == :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 %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% if post_version_listing == :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}") %>
<% end %>
<% t.column "Tags", {class: "col-expand"} do |post_version| %>
<%= post_version_diff(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 })) %>
<div>
<%= compact_time(post_version.updated_at) %>
<% if CurrentUser.is_moderator? %>
(<%= link_to_ip post_version.updater_ip_addr %>)
<% end %>
</div>
<% end %>
<% t.column "" do |post_version| %>
<% 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_version_listing == :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 %>
<% end %>
</div>

View File

@@ -8,46 +8,32 @@
<%= f.submit "Search" %>
<% end %>
<table class="striped autofit">
<thead>
<tr>
<th>Post</th>
<th>Tags</th>
<th>Score</th>
<th>Uploader</th>
<th>Voter</th>
<th></th>
</tr>
</thead>
<tbody>
<% @post_votes.each do |vote| %>
<tr>
<td>
<%= PostPresenter.preview(vote.post, show_deleted: true) %>
</td>
<td class="col-expand">
<%= TagSetPresenter.new(vote.post.tag_array).inline_tag_list_html %>
</td>
<td><%= link_to sprintf("%+d", vote.score), post_votes_path(search: { score: vote.score }) %></td>
<td>
<%= link_to_user vote.post.uploader %>
<%= link_to "»", post_votes_path(search: { post_tags_match: "user:#{vote.post.uploader.name}" }) %>
<div><%= time_ago_in_words_tagged(vote.post.created_at) %></div>
</td>
<td>
<%= link_to_user vote.user %>
<%= link_to "»", post_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", post_post_votes_path(vote.post), remote: true, method: :delete %>
<% end %>
</td>
</tr>
<%= table_for @post_votes, {class: "striped autofit"} do |t| %>
<% t.column "Post" do |vote| %>
<%= PostPresenter.preview(vote.post, show_deleted: true) %>
<% end %>
<% t.column "Tags", nil, {class: "col-expand"} do |vote| %>
<%= TagSetPresenter.new(vote.post.tag_array).inline_tag_list_html %>
<% end %>
<% t.column "Score" do |vote| %>
<%= link_to sprintf("%+d", vote.score), post_votes_path(search: { score: vote.score }) %>
<% end %>
<% t.column "Uploader" do |vote| %>
<%= link_to_user vote.user %>
<%= link_to "»", post_votes_path(search: { user_name: vote.user.name }) %>
<div><%= time_ago_in_words_tagged(vote.created_at) %></div>
<% end %>
<% t.column "Voter" do |vote| %>
<%= link_to_user vote.user %>
<%= link_to "»", post_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", post_post_votes_path(vote.post), remote: true, method: :delete %>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<%= numbered_paginator(@post_votes) %>
</div>

View File

@@ -14,44 +14,33 @@
<%= f.submit "Search" %>
<% end %>
<table class="striped autofit" width="100%">
<thead>
<tr>
<th data-sort="string">Query</th>
<th data-sort="string">Labels</th>
<th>Posts</th>
<th>Refreshed</th>
<th>Created</th>
<th class="links"></th>
</tr>
</thead>
<tbody>
<% @saved_searches.each do |ss| %>
<tr id="saved-search-<%= ss.id %>">
<td class="col-expand"><%= link_to ss.query, posts_path(tags: ss.query) %></td>
<td>
<% ss.labels.each do |label| %>
<%= link_to label, posts_path(:tags => "search:#{label}") %>
<% end %>
</td>
<td><%= ss.cached_size if ss.cached_size > 0 %></td>
<td>
<% if ss.refreshed_at.present? %>
<%= time_ago_in_words_tagged ss.refreshed_at %>
<% else %>
&gt;<%= SavedSearch::REDIS_EXPIRY.inspect %> ago
<% end %>
</td>
<td><%= time_ago_in_words_tagged ss.created_at %></td>
<td class="links">
<%= link_to "edit", edit_saved_search_path(ss) %>
| <%= link_to "delete", saved_search_path(ss), :method => :delete, :remote => true %>
</td>
</tr>
<%= table_for @saved_searches, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Query", {"data-sort": "string"}, {class: "col-expand"} do |ss| %>
<%= link_to ss.query, posts_path(tags: ss.query) %>
<% end %>
<% t.column "Labels", {"data-sort": "string"} do |ss| %>
<% ss.labels.each do |label| %>
<%= link_to label, posts_path(:tags => "search:#{label}") %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Posts" do |ss| %>
<%= ss.cached_size if ss.cached_size > 0 %>
<% end %>
<% t.column "Refreshed" do |ss| %>
<% if ss.refreshed_at.present? %>
<%= time_ago_in_words_tagged ss.refreshed_at %>
<% else %>
&gt;<%= SavedSearch::REDIS_EXPIRY.inspect %> ago
<% end %>
<% end %>
<% t.column "Created" do |ss| %>
<%= time_ago_in_words_tagged ss.created_at %>
<% end %>
<% t.column "", {class: "links"}, {class: "links"} do |ss| %>
<%= link_to "edit", edit_saved_search_path(ss) %>
| <%= link_to "delete", saved_search_path(ss), :method => :delete, :remote => true %>
<% end %>
<% end %>
<%= numbered_paginator(@saved_searches) %>
</div>

View File

@@ -1,18 +1,24 @@
<%= tag.table table.html_attributes do %>
<%= tag.table table.table_attributes do %>
<thead>
<tr>
<% table.columns.each do |column| %>
<th><%= column.name %></th>
<%= tag.th column.header_attributes do %>
<% if column.is_html_safe %>
<%= column.name.html_safe %>
<% else %>
<%= column.name %>
<% end %>
<% end %>
<% end %>
</tr>
</thead>
<tbody>
<% table.items.each do |item| %>
<%= tag.tr table.row_attributes(item) do %>
<% table.columns.each do |column| %>
<%= tag.td column.html_attributes do %>
<%= column.value(item) %>
<% table.items.each_with_index do |item, i| %>
<%= tag.tr table.all_row_attributes(item, i) do %>
<% table.columns.each_with_index do |column, j| %>
<%= tag.td column.body_attributes do %>
<%= column.value(item, i, j) %>
<% end %>
<% end %>
<% end %>

View File

@@ -1,44 +1,34 @@
<table width="100%" class="striped">
<thead>
<tr>
<th width="25%">From</th>
<th width="25%">To</th>
<th width="10%">Reference</th>
<th width="15%">Approver</th>
<th width="5%">Status</th>
<th width="15%"></th>
</tr>
</thead>
<tbody>
<% tag_aliases.each do |tag_alias| %>
<tr id="tag-alias-<%= tag_alias.id %>">
<td class="category-<%= tag_alias.antecedent_tag.try(:category) %>"><%= link_to tag_alias.antecedent_name, posts_path(:tags => tag_alias.antecedent_name) %> <span class="count"><%= tag_alias.antecedent_tag.post_count rescue 0 %></span></td>
<td class="category-<%= tag_alias.consequent_tag.try(:category) %>"><%= link_to tag_alias.consequent_name, posts_path(:tags => tag_alias.consequent_name) %> <span class="count"><%= tag_alias.consequent_tag.post_count rescue 0 %></span></td>
<td>
<% if tag_alias.forum_topic_id %>
<%= link_to tag_alias.forum_topic_id, forum_topic_path(tag_alias.forum_topic_id) %>
<% end %>
</td>
<td><%= link_to_user(tag_alias.approver) if tag_alias.approver %></td>
<td id="tag-alias-status-for-<%= tag_alias.id %>">
<%= tag_alias.status %>
</td>
<td>
<%= link_to "Show", tag_alias_path(tag_alias) %>
<% if tag_alias.editable_by?(CurrentUser.user) %>
| <%= link_to "Edit", edit_tag_alias_path(tag_alias) %>
<% end %>
<% if tag_alias.deletable_by?(CurrentUser.user) %>
| <%= link_to "Delete", tag_alias_path(tag_alias), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this alias?"} %>
<% end %>
<% if CurrentUser.is_admin? && tag_alias.is_pending? %>
| <%= link_to "Approve", approve_tag_alias_path(tag_alias), :remote => true, :method => :post %>
<% end %>
</td>
</tr>
<%= table_for tag_aliases, {class: "striped", width: "100%"} do |t| %>
<% t.column "From", {width: "25%"} do |tag_alias| %>
<span class="category-<%= tag_alias.antecedent_tag.try(:category) %>"><%= link_to tag_alias.antecedent_name, posts_path(:tags => tag_alias.antecedent_name) %> <span class="count"><%= tag_alias.antecedent_tag.post_count rescue 0 %></span></span>
<% end %>
<% t.column "To", {width: "25%"} do |tag_alias| %>
<span class="category-<%= tag_alias.consequent_tag.try(:category) %>"><%= link_to tag_alias.consequent_name, posts_path(:tags => tag_alias.consequent_name) %> <span class="count"><%= tag_alias.consequent_tag.post_count rescue 0 %></span></span>
<% end %>
<% t.column "Reference", {width: "10%"} do |tag_alias| %>
<% if tag_alias.forum_topic_id %>
<%= link_to tag_alias.forum_topic_id, forum_topic_path(tag_alias.forum_topic_id) %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Approver", {width: "15%"} do |tag_alias| %>
<%= link_to_user(tag_alias.approver) if tag_alias.approver %>
<% end %>
<% t.column "Status", {width: "5%"} do |tag_alias| %>
<span id="tag-alias-status-for-<%= tag_alias.id %>"><%= tag_alias.status %></span>
<% end %>
<% t.column "", {width: "15%"} do |tag_alias| %>
<%= link_to "Show", tag_alias_path(tag_alias) %>
<% if tag_alias.is_pending? && tag_alias.editable_by?(CurrentUser.user) %>
| <%= link_to "Edit", edit_tag_alias_path(tag_alias) %>
<% end %>
<% if tag_alias.deletable_by?(CurrentUser.user) %>
| <%= link_to "Delete", tag_alias_path(tag_alias), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this alias?"} %>
<% end %>
<% if CurrentUser.user.is_admin? && tag_alias.is_pending? %>
| <%= link_to "Approve", approve_tag_alias_path(tag_alias), :remote => true, :method => :post %>
<% end %>
<% end %>
<% end %>

View File

@@ -1,42 +1,34 @@
<table width="100%" class="striped">
<thead>
<tr>
<th width="25%">From</th>
<th width="25%">To</th>
<th width="10%">Reference</th>
<th width="15%">Approver</th>
<th width="5%">Status</th>
<th width="15%"></th>
</tr>
</thead>
<tbody>
<% tag_implications.each do |tag_implication| %>
<tr id="tag-implication-<%= tag_implication.id %>">
<td class="category-<%= tag_implication.antecedent_tag.try(:category) %>"><%= link_to tag_implication.antecedent_name, posts_path(:tags => tag_implication.antecedent_name) %> <span class="count"><%= tag_implication.antecedent_tag.post_count rescue 0 %></span></td>
<td class="category-<%= tag_implication.consequent_tag.try(:category) %>"><%= link_to tag_implication.consequent_name, posts_path(:tags => tag_implication.consequent_name) %> <span class="count"><%= tag_implication.consequent_tag.post_count rescue 0 %></span></td>
<td>
<% if tag_implication.forum_topic_id %>
<%= link_to tag_implication.forum_topic_id, forum_topic_path(tag_implication.forum_topic_id) %>
<% end %>
</td>
<td><%= link_to_user(tag_implication.approver) if tag_implication.approver %></td>
<td id="tag-implication-status-for-<%= tag_implication.id %>"><%= tag_implication.status %></td>
<td>
<%= link_to "Show", tag_implication_path(tag_implication) %>
<% if tag_implication.is_pending? && tag_implication.editable_by?(CurrentUser.user) %>
| <%= link_to "Edit", edit_tag_implication_path(tag_implication) %>
<% end %>
<% if tag_implication.deletable_by?(CurrentUser.user) %>
| <%= link_to "Delete", tag_implication_path(tag_implication), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this implication?"} %>
<% end %>
<% if CurrentUser.user.is_admin? && tag_implication.is_pending? %>
| <%= link_to "Approve", approve_tag_implication_path(tag_implication), :remote => true, :method => :post %>
<% end %>
</td>
</tr>
<%= table_for tag_implications, {class: "striped", width: "100%"} do |t| %>
<% t.column "From", {width: "25%"} do |tag_implication| %>
<span class="category-<%= tag_implication.antecedent_tag.try(:category) %>"><%= link_to tag_implication.antecedent_name, posts_path(:tags => tag_implication.antecedent_name) %> <span class="count"><%= tag_implication.antecedent_tag.post_count rescue 0 %></span></span>
<% end %>
<% t.column "To", {width: "25%"} do |tag_implication| %>
<span class="category-<%= tag_implication.consequent_tag.try(:category) %>"><%= link_to tag_implication.consequent_name, posts_path(:tags => tag_implication.consequent_name) %> <span class="count"><%= tag_implication.consequent_tag.post_count rescue 0 %></span></span>
<% end %>
<% t.column "Reference", {width: "10%"} do |tag_implication| %>
<% if tag_implication.forum_topic_id %>
<%= link_to tag_implication.forum_topic_id, forum_topic_path(tag_implication.forum_topic_id) %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Approver", {width: "15%"} do |tag_implication| %>
<%= link_to_user(tag_implication.approver) if tag_implication.approver %>
<% end %>
<% t.column "Status", {width: "5%"} do |tag_implication| %>
<span id="tag-implication-status-for-<%= tag_implication.id %>"><%= tag_implication.status %></span>
<% end %>
<% t.column "", {width: "15%"} do |tag_implication| %>
<%= link_to "Show", tag_implication_path(tag_implication) %>
<% if tag_implication.is_pending? && tag_implication.editable_by?(CurrentUser.user) %>
| <%= link_to "Edit", edit_tag_implication_path(tag_implication) %>
<% end %>
<% if tag_implication.deletable_by?(CurrentUser.user) %>
| <%= link_to "Delete", tag_implication_path(tag_implication), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this implication?"} %>
<% end %>
<% if CurrentUser.user.is_admin? && tag_implication.is_pending? %>
| <%= link_to "Approve", approve_tag_implication_path(tag_implication), :remote => true, :method => :post %>
<% end %>
<% end %>
<% end %>

View File

@@ -2,9 +2,9 @@
<div id="a-index" class="fixed-width-container">
<%= render "search" %>
<%= table_for @tags, class: "striped autofit" do |t| %>
<% t.column :post_count, name: "Count" %>
<% t.column :name, class: "col-expand" do |tag| %>
<%= table_for @tags, {class: "striped autofit"} do |t| %>
<% t.column :post_count, nil, {name: "Count"} %>
<% t.column "Name", nil, {class: "col-expand"} do |tag| %>
<%= link_to_wiki "?", tag.name, class: "tag-type-#{tag.category}" %>
<%= link_to tag.name, posts_path(tags: tag.name), class: "tag-type-#{tag.category}" %>
<% end %>

View File

@@ -3,75 +3,61 @@
<%= render "uploads/search" %>
<%= render "posts/partials/common/inline_blacklist" %>
<table width="100%" class="striped autofit">
<thead>
<tr>
<th>Upload</th>
<th>Info</th>
<th>Uploader</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<% @uploads.each do |upload| %>
<tr>
<td>
<%= PostPresenter.preview(upload.post, tags: "user:#{upload.uploader.name}", show_deleted: true) %>
</td>
<td class="col-expand upload-info">
<span class="info">
<strong>Upload</strong>
<%= link_to "##{upload.id}", upload %>
</span>
<%= table_for @uploads, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Upload" do |upload| %>
<%= PostPresenter.preview(upload.post, tags: "user:#{upload.uploader.name}", show_deleted: true) %>
<% end %>
<% t.column "Info", nil, {class: "col-expand upload-info"} do |upload| %>
<span class="info">
<strong>Upload</strong>
<%= link_to "##{upload.id}", upload %>
</span>
<span class="info">
<strong>Rating</strong>
<%= upload.rating %>
</span>
<span class="info">
<strong>Rating</strong>
<%= upload.rating %>
</span>
<% if upload.post.present? %>
<span class="info">
<strong>Size</strong>
<%= link_to "#{upload.post.file_size.to_s(:human_size, precision: 4)} #{upload.post.file_ext}", upload.post.file_url %>
<% if upload.post.has_dimensions? %>
(<%= upload.post.image_width %>x<%= upload.post.image_height %>)
<% end %>
</span>
<% end %>
<br>
<span class="info">
<strong>Source</strong>
<%= link_to_if (upload.source =~ %r!\Ahttps?://!i), (upload.source.presence.try(:truncate, 50) || content_tag(:em, "none")), upload.source %>
<%= link_to "»", uploads_path(search: params[:search].merge(source_matches: upload.source)) %>
</span>
<br>
<% if upload.referer_url.present? %>
<span class="info">
<strong>Referer</strong>
<%= URI.parse(upload.referer_url).host rescue nil %>
</span>
<br>
<% end %>
<span class="info">
<strong>Tags</strong>
<%= upload.presenter.inline_tag_list_html %>
</span>
</td>
<td>
<%= link_to_user upload.uploader %>
<%= link_to "»", uploads_path(search: params[:search].merge(uploader_name: upload.uploader.name)) %>
<br><%= time_ago_in_words_tagged upload.created_at %>
</td>
<td class="col-normal">
<%= render_status(upload) %>
</td>
</tr>
<% if upload.post.present? %>
<span class="info">
<strong>Size</strong>
<%= link_to "#{upload.post.file_size.to_s(:human_size, precision: 4)} #{upload.post.file_ext}", upload.post.file_url %>
<% if upload.post.has_dimensions? %>
(<%= upload.post.image_width %>x<%= upload.post.image_height %>)
<% end %>
</span>
<% end %>
</tbody>
</table>
<br>
<span class="info">
<strong>Source</strong>
<%= link_to_if (upload.source =~ %r!\Ahttps?://!i), (upload.source.presence.try(:truncate, 50) || content_tag(:em, "none")), upload.source %>
<%= link_to "»", uploads_path(search: params[:search].merge(source_matches: upload.source)) %>
</span>
<br>
<% if upload.referer_url.present? %>
<span class="info">
<strong>Referer</strong>
<%= URI.parse(upload.referer_url).host rescue nil %>
</span>
<br>
<% end %>
<span class="info">
<strong>Tags</strong>
<%= upload.presenter.inline_tag_list_html %>
</span>
<% end %>
<% t.column "Uploader" do |upload| %>
<%= link_to_user upload.uploader %>
<%= link_to "»", uploads_path(search: params[:search].merge(uploader_name: upload.uploader.name)) %>
<br><%= time_ago_in_words_tagged upload.created_at %>
<% end %>
<% t.column "Status", nil, {class: "col-normal"} do |upload| %>
<%= render_status(upload) %>
<% end %>
<% end %>
<%= numbered_paginator(@uploads) %>
</div>

View File

@@ -13,57 +13,41 @@
<%= f.submit "Search" %>
<% end %>
<table class="striped autofit">
<thead>
<tr>
<th>User</th>
<th>Message</th>
<% if CurrentUser.is_moderator? %>
<th>Status</th>
<% end %>
<th>Category</th>
<th>Creator</th>
<th></th>
</tr>
</thead>
<tbody>
<% @user_feedbacks.each do |feedback| %>
<tr class="feedback-category-<%= feedback.category %>">
<td>
<%= link_to_user feedback.user %>
<%= link_to "»", user_feedbacks_path(search: { user_name: feedback.user.name }) %>
</td>
<td class="col-expand">
<div class="prose">
<%= format_text(feedback.body) %>
</div>
<%= render "application/update_notice", record: feedback, interval: 0.minutes %>
</td>
<% if CurrentUser.is_moderator? %>
<td><%= "deleted" if feedback.is_deleted? %></td>
<% end %>
<td>
<%= link_to feedback.category.capitalize, user_feedbacks_path(search: { category: feedback.category }) %>
</td>
<td>
<%= link_to_user feedback.creator %>
<%= link_to "»", user_feedbacks_path(search: { creator_name: feedback.creator.name }) %>
<div><%= time_ago_in_words_tagged(feedback.created_at) %></div>
</td>
<td>
<% if feedback.editable_by?(CurrentUser.user) %>
<%= link_to "edit", edit_user_feedback_path(feedback) %>
<% if feedback.deletable_by?(CurrentUser.user) && !feedback.is_deleted? %>
| <%= link_to "delete", user_feedback_path(feedback), method: :put, remote: true, "data-params": "user_feedback[is_deleted]=true", "data-confirm": "Are you sure you want to delete this user feedback?" %>
<% elsif feedback.deletable_by?(CurrentUser.user) && feedback.is_deleted? %>
| <%= link_to "undelete", user_feedback_path(feedback), method: :put, remote: true, "data-params": "user_feedback[is_deleted]=false" %>
<% end %>
<% end %>
</td>
</tr>
<%= table_for @user_feedbacks, {class: "striped autofit"}, {class: ["feedback-category-%s", "item.category"]} do |t| %>
<% t.column "User" do |feedback| %>
<%= link_to_user feedback.user %>
<%= link_to "»", user_feedbacks_path(search: { user_name: feedback.user.name }) %>
<% end %>
<% t.column "Message", nil, {class: "col-expand"} do |feedback| %>
<div class="prose">
<%= format_text(feedback.body) %>
</div>
<%= render "application/update_notice", record: feedback, interval: 0.minutes %>
<% end %>
<% if CurrentUser.is_moderator? %>
<% t.column "Status" do |feedback| %>
<%= "deleted" if feedback.is_deleted? %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Category" do |feedback| %>
<%= link_to feedback.category.capitalize, user_feedbacks_path(search: { category: feedback.category }) %>
<% end %>
<% t.column "Creator" do |feedback| %>
<%= link_to_user feedback.creator %>
<%= link_to "»", user_feedbacks_path(search: { creator_name: feedback.creator.name }) %>
<div><%= time_ago_in_words_tagged(feedback.created_at) %></div>
<% end %>
<% t.column "" do |feedback| %>
<% if feedback.editable_by?(CurrentUser.user) %>
<%= link_to "edit", edit_user_feedback_path(feedback) %>
<% if feedback.deletable_by?(CurrentUser.user) && !feedback.is_deleted? %>
| <%= link_to "delete", user_feedback_path(feedback), method: :put, remote: true, "data-params": "user_feedback[is_deleted]=true", "data-confirm": "Are you sure you want to delete this user feedback?" %>
<% elsif feedback.deletable_by?(CurrentUser.user) && feedback.is_deleted? %>
| <%= link_to "undelete", user_feedback_path(feedback), method: :put, remote: true, "data-params": "user_feedback[is_deleted]=false" %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= numbered_paginator(@user_feedbacks) %>
</div>

View File

@@ -2,28 +2,23 @@
<div id="a-index">
<h1>Name Change Requests</h1>
<table class="striped" width="100%">
<thead>
<tr>
<th>User</th>
<th>Old Name</th>
<th>New Name</th>
<th>Date</th>
<th></th>
</tr>
</thead>
<tbody>
<% @change_requests.each do |change_request| %>
<tr>
<td><%= link_to_user change_request.user %></td>
<td><%= change_request.original_name %></td>
<td><%= change_request.desired_name %></td>
<td><%= compact_time change_request.created_at %></td>
<td><%= link_to "view", user_name_change_request_path(change_request) %></td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @change_requests, {class: "striped", width: "100%"} do |t| %>
<% t.column "User" do |change_request| %>
<%= link_to_user change_request.user %>
<% end %>
<% t.column "Old Name" do |change_request| %>
<%= change_request.original_name %>
<% end %>
<% t.column "New Name" do |change_request| %>
<%= change_request.desired_name %>
<% end %>
<% t.column "Date" do |change_request| %>
<%= compact_time change_request.created_at %>
<% end %>
<% t.column "" do |change_request| %>
<%= link_to "view", user_name_change_request_path(change_request) %>
<% end %>
<% end %>
<%= numbered_paginator(@change_requests) %>
</div>

View File

@@ -2,43 +2,37 @@
<div id="a-index">
<h1>Users</h1>
<table width="100%" class="striped">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Posts</th>
<th>Deleted</th>
<th>Notes</th>
<th>Edits</th>
<th>Level</th>
<th>Joined</th>
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td>
<% if CurrentUser.is_admin? %>
<%= link_to "Edit", edit_admin_user_path(user) %>
<% end %>
</td>
<td>
<%= link_to_user user %>
<% if user.inviter %>
&larr; <%= link_to_user user.inviter %>
<% end %>
</td>
<td><%= link_to user.posts.count, posts_path(:tags => "user:#{user.name}") %></td>
<td><%= user.posts.deleted.count %></td>
<td><%= link_to user.note_versions.count, note_versions_path(:search => {:updater_id => user.id}) %></td>
<td><%= link_to user.post_update_count, post_versions_path(:search => {:updater_id => user.id}) %></td>
<td><%= user.level_string %></td>
<td><%= compact_time user.created_at %></td>
</tr>
<%= table_for @users, {class: "striped", width: "100%"} do |t| %>
<% t.column "" do |user| %>
<% if CurrentUser.is_admin? %>
<%= link_to "Edit", edit_admin_user_path(user) %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Name" do |user| %>
<%= link_to_user user %>
<% if user.inviter %>
&larr; <%= link_to_user user.inviter %>
<% end %>
<% end %>
<% t.column "Posts" do |user| %>
<%= link_to user.posts.count, posts_path(:tags => "user:#{user.name}") %>
<% end %>
<% t.column "Deleted" do |user| %>
<%= user.posts.deleted.count %>
<% end %>
<% t.column "Notes" do |user| %>
<%= link_to user.note_versions.count, note_versions_path(:search => {:updater_id => user.id}) %>
<% end %>
<% t.column "Edits" do |user| %>
<%= link_to user.post_update_count, post_versions_path(:search => {:updater_id => user.id}) %>
<% end %>
<% t.column "Level" do |user| %>
<%= user.level_string %>
<% end %>
<% t.column "Joined" do |user| %>
<%= compact_time user.created_at %>
<% end %>
<% end %>
<%= numbered_paginator(@users) %>

View File

@@ -1,36 +1,28 @@
<div id="p-global-listing">
<table width="100%" class="striped">
<thead>
<tr>
<th width="3%"></th>
<th>Title</th>
<th width="5%">Status</th>
<th width="26%">Last edited</th>
</tr>
</thead>
<tbody>
<% @wiki_page_versions.each do |wiki_page_version| %>
<tr>
<td>
<%= 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) %>
</td>
<td class="category-<%= wiki_page_version.category_name %>">
<%= link_to "?", wiki_page_path(wiki_page_version.wiki_page_id) %>
<%= link_to wiki_page_version.title, wiki_page_version %>
<%= link_to "»", wiki_page_versions_path(search: { wiki_page_id: wiki_page_version.wiki_page_id }) %>
</td>
<td><%= wiki_page_version_status_diff(wiki_page_version) %></td>
<td>
<%= compact_time(wiki_page_version.updated_at) %>
by
<%= link_to_user wiki_page_version.updater %>
<% if CurrentUser.is_moderator? %>
(<%= link_to_ip wiki_page_version.updater_ip_addr %>)
<% end %>
<%= link_to "»", wiki_page_versions_path(search: { updater_id: wiki_page_version.updater.id }) %>
</td>
</tr>
<%= table_for @wiki_page_versions, {class: "striped", width: "100%"} do |t| %>
<% t.column "", {width: "3%"} do |wiki_page_version| %>
<%= 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 %>
<% t.column "Title" do |wiki_page_version| %>
<span class="category-<%= wiki_page_version.category_name %>">
<%= link_to "?", wiki_page_path(wiki_page_version.wiki_page_id) %>
<%= link_to wiki_page_version.title, wiki_page_version %>
<%= link_to "»", wiki_page_versions_path(search: { wiki_page_id: wiki_page_version.wiki_page_id }) %>
</span>
<% end %>
<% t.column "Status", {width: "5%"} do |wiki_page_version| %>
<%= wiki_page_version_status_diff(wiki_page_version) %>
<% end %>
<% t.column "Last edited", {width: "26%"} do |wiki_page_version| %>
<%= compact_time(wiki_page_version.updated_at) %>
by
<%= link_to_user wiki_page_version.updater %>
<% if CurrentUser.is_moderator? %>
(<%= link_to_ip wiki_page_version.updater_ip_addr %>)
<% end %>
</tbody>
</table>
<%= link_to "»", wiki_page_versions_path(search: { updater_id: wiki_page_version.updater.id }) %>
<% end %>
<% end %>
</div>

View File

@@ -1,47 +1,39 @@
<div id="p-page-listing">
<%= form_tag(diff_wiki_page_versions_path, :method => :get) do %>
<table width="100%" class="striped">
<thead>
<tr>
<th width="3%"></th>
<th width="2%"></th>
<th width="2%"></th>
<th>Title</th>
<th width="5%">Status</th>
<th width="26%">Last edited</th>
</tr>
</thead>
<tbody>
<% @wiki_page_versions.each_with_index do |wiki_page_version, i| %>
<tr>
<td>
<% if i < @wiki_page_versions.length - 1 %>
<%= link_to "diff", diff_wiki_page_versions_path(:otherpage => wiki_page_version.id, :thispage => @wiki_page_versions[i + 1].id) %>
<% else %>
diff
<% end %>
</td>
<td><%= radio_button_tag "thispage", wiki_page_version.id, (i == 1) %></td>
<td><%= radio_button_tag "otherpage", wiki_page_version.id, (i == 0) %></td>
<td class="category-<%= wiki_page_version.category_name %>">
<%= link_to "?", wiki_page_path(wiki_page_version.wiki_page_id) %>
<%= link_to wiki_page_version.title, wiki_page_version %>
</td>
<td><%= wiki_page_version_status_diff(wiki_page_version) %></td>
<td>
<%= compact_time(wiki_page_version.updated_at) %>
by
<%= link_to_user wiki_page_version.updater %>
<% if CurrentUser.is_moderator? %>
(<%= link_to_ip wiki_page_version.updater_ip_addr %>)
<% end %>
<%= link_to "»", wiki_page_versions_path(search: { updater_id: wiki_page_version.updater.id }) %>
</td>
</tr>
<%= table_for @wiki_page_versions, {class: "striped", width: "100%"} do |t| %>
<% t.column "", {width: "3%"} do |wiki_page_version, i| %>
<% if i < @wiki_page_versions.length - 1 %>
<%= link_to "diff", diff_wiki_page_versions_path(:otherpage => wiki_page_version.id, :thispage => @wiki_page_versions[i + 1].id) %>
<% else %>
diff
<% end %>
</tbody>
</table>
<% end %>
<% t.column "", {width: "2%"} do |wiki_page_version, i| %>
<%= radio_button_tag "thispage", wiki_page_version.id, (i == 1) %>
<% end %>
<% t.column "", {width: "2%"} do |wiki_page_version, i| %>
<%= radio_button_tag "otherpage", wiki_page_version.id, (i == 0) %>
<% end %>
<% t.column "Title" do |wiki_page_version| %>
<span class="category-<%= wiki_page_version.category_name %>">
<%= link_to "?", wiki_page_path(wiki_page_version.wiki_page_id) %>
<%= link_to wiki_page_version.title, wiki_page_version %>
</span>
<% end %>
<% t.column "Status", {width: "5%"} do |wiki_page_version| %>
<%= wiki_page_version_status_diff(wiki_page_version) %>
<% end %>
<% t.column "Last edited", {width: "26%"} do |wiki_page_version| %>
<%= compact_time(wiki_page_version.updated_at) %>
by
<%= link_to_user wiki_page_version.updater %>
<% if CurrentUser.is_moderator? %>
(<%= link_to_ip wiki_page_version.updater_ip_addr %>)
<% end %>
<%= link_to "»", wiki_page_versions_path(search: { updater_id: wiki_page_version.updater.id }) %>
<% end %>
<% end %>
<%= submit_tag "Diff" %>
<% end %>

View File

@@ -3,22 +3,14 @@
<% content_for(:content) do %>
<h1>Wiki</h1>
<table class="striped" width="100%">
<thead>
<tr>
<th>Title</th>
<th>Last edited</th>
</tr>
</thead>
<tbody>
<% @wiki_pages.each do |wiki_page| %>
<tr>
<td class="category-<%= wiki_page.category_name %>"><%= link_to_wiki wiki_page.title %></td>
<td><%= time_ago_in_words_tagged(wiki_page.updated_at) %></td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @wiki_pages, {class: "striped", width: "100%"} do |t| %>
<% t.column "Title" do |wiki_page| %>
<span class="category-<%= wiki_page.category_name %>"><%= link_to_wiki wiki_page.title %></span>
<% end %>
<% t.column "Last edited" do |wiki_page| %>
<%= time_ago_in_words_tagged(wiki_page.updated_at) %>
<% end %>
<% end %>
<%= numbered_paginator(@wiki_pages) %>
<% end %>