Files
danbooru/app/views/post_replacements/index.html.erb
2019-08-24 22:55:35 -05:00

85 lines
3.2 KiB
Plaintext

<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], data: { autocomplete: "user" } } %>
<%= f.input :post_tags_match, label: "Tags", input_html: { value: params[:search][:post_tags_match], data: { autocomplete: "tag-query" } } %>
<%= 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>
<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>
<% end %>
</tbody>
</table>
<%= numbered_paginator(@post_replacements) %>
</div>
</div>