Add post regenerations

This commit is contained in:
BrokenEagle
2020-11-22 07:08:40 +00:00
committed by evazion
parent e6f2bf1c89
commit 16d6f3bbd5
13 changed files with 234 additions and 12 deletions

View File

@@ -0,0 +1,5 @@
<% if @post_regeneration.errors.any? %>
Danbooru.error("<%= j @post_regeneration.errors.full_messages.join(',') %>");
<% else %>
Danbooru.notice("Post regenerated");
<% end %>

View File

@@ -0,0 +1,17 @@
<div id="c-post-regenerations">
<div id="a-index">
<h1>Post regenerations</h1>
<%= table_for @post_regenerations, width: "100%" do |t| %>
<% t.column "Post", width: "1%" do |regeneration| %>
<%= PostPresenter.preview(regeneration.post, show_deleted: true) %>
<% end %>
<% t.column :category %>
<% t.column "Creator", width: "10%" do |regeneration| %>
<%= compact_time regeneration.created_at %>
<br> by <%= link_to_user regeneration.creator %>
<% end %>
<% end %>
<%= numbered_paginator(@post_regenerations) %>
</div>
</div>

View File

@@ -86,4 +86,9 @@
<li id="post-option-replace-image"><%= link_to "Replace image", new_post_replacement_path(post_id: post.id), remote: true %></li>
<% end %>
<% end %>
<% if policy(PostRegeneration).create? %>
<li id="post-option-regenerate-iqdb"><%= link_to "Regenerate IQDB", post_regenerations_path(post_regeneration: {post_id: post.id, category: "iqdb"}), remote: true, method: :post %></li>
<li id="post-option-regenerate-preview"><%= link_to "Regenerate image sizes", post_regenerations_path(post_regeneration: {post_id: post.id, category: "resizes"}), remote: true, method: :post %></li>
<% end %>
</ul>

View File

@@ -33,6 +33,7 @@
<li id="post-history-moderation"><%= link_to "Moderation", post_events_path(@post.id) %></li>
<li id="post-history-commentary"><%= link_to "Commentary", artist_commentary_versions_path(search: { post_id: @post.id }) %></li>
<li id="post-history-replacements"><%= link_to "Replacements", post_replacements_path(search: {post_id: @post.id }) %></li>
<li id="post-history-regenerations"><%= link_to "Regenerations", post_regenerations_path(search: {post_id: @post.id }) %></li>
</ul>
</section>
<% end %>