post replacements: add /post_replacements view.
This commit is contained in:
@@ -101,6 +101,14 @@ module ApplicationHelper
|
|||||||
time_tag(time.strftime("%Y-%m-%d %H:%M"), time)
|
time_tag(time.strftime("%Y-%m-%d %H:%M"), time)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def external_link_to(url)
|
||||||
|
if url =~ %r!\Ahttps?://!i
|
||||||
|
link_to url, {}, {rel: :nofollow}
|
||||||
|
else
|
||||||
|
url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def link_to_ip(ip)
|
def link_to_ip(ip)
|
||||||
link_to ip, moderator_ip_addrs_path(:search => {:ip_addr => ip})
|
link_to ip, moderator_ip_addrs_path(:search => {:ip_addr => ip})
|
||||||
end
|
end
|
||||||
|
|||||||
54
app/views/post_replacements/index.html.erb
Normal file
54
app/views/post_replacements/index.html.erb
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<div id="c-post-replacements">
|
||||||
|
<div id="a-index">
|
||||||
|
<h1>Post Replacements</h1>
|
||||||
|
|
||||||
|
<%= render "posts/partials/common/inline_blacklist" %>
|
||||||
|
|
||||||
|
<%= simple_form_for(:search, url: post_replacements_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
|
||||||
|
<%= f.input :creator_name, label: "Replacer", input_html: { value: params[:search][:creator_name] } %>
|
||||||
|
<%= f.submit "Search" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<table width="100%" class="striped autofit">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="1%">Post</th>
|
||||||
|
<th>Source</th>
|
||||||
|
<th>Replacer</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @post_replacements.each do |post_replacement| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= PostPresenter.preview(post_replacement.post) %></td>
|
||||||
|
<td>
|
||||||
|
<dl>
|
||||||
|
<dt>Original Source</dt>
|
||||||
|
<dd><%= external_link_to post_replacement.original_url %></dd>
|
||||||
|
<dt>Replacement Source</dt>
|
||||||
|
<dd>
|
||||||
|
<% if post_replacement.replacement_url.present? %>
|
||||||
|
<%= external_link_to post_replacement.replacement_url %>
|
||||||
|
<% else %>
|
||||||
|
<em>file</em>
|
||||||
|
<% end %>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</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>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<%= numbered_paginator(@post_replacements) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% content_for(:page_title) do %>
|
||||||
|
Post Replacements - <%= Danbooru.config.app_name %>
|
||||||
|
<% end %>
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
<li><%= fast_link_to "Notes", note_versions_path(:search => {:post_id => @post.id}) %></li>
|
<li><%= fast_link_to "Notes", note_versions_path(:search => {:post_id => @post.id}) %></li>
|
||||||
<li><%= fast_link_to "Flags & Appeals", post_events_path(@post.id) %></li>
|
<li><%= fast_link_to "Flags & Appeals", post_events_path(@post.id) %></li>
|
||||||
<li><%= fast_link_to "Commentary", artist_commentary_versions_path(:search => {:post_id => @post.id}) %></li>
|
<li><%= fast_link_to "Commentary", artist_commentary_versions_path(:search => {:post_id => @post.id}) %></li>
|
||||||
|
<li><%= fast_link_to "Replacements", post_replacements_path(:search => {:post_id => @post.id}) %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<li><%= link_to("Upload Listing", uploads_path) %></li>
|
<li><%= link_to("Upload Listing", uploads_path) %></li>
|
||||||
<li><%= link_to("Appeals", post_appeals_path) %></li>
|
<li><%= link_to("Appeals", post_appeals_path) %></li>
|
||||||
<li><%= link_to("Flags", post_flags_path) %></li>
|
<li><%= link_to("Flags", post_flags_path) %></li>
|
||||||
|
<li><%= link_to("Replacements", post_replacements_path) %></li>
|
||||||
<% if CurrentUser.can_approve_posts? %>
|
<% if CurrentUser.can_approve_posts? %>
|
||||||
<li><%= link_to("Moderate", moderator_post_queue_path) %></li>
|
<li><%= link_to("Moderate", moderator_post_queue_path) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user