post replacement: add "Replace Image" dialog to post sidebar.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
this.initialize_post_image_resize_links();
|
||||
this.initialize_post_image_resize_to_window_link();
|
||||
this.initialize_similar();
|
||||
this.initialize_replace_image_dialog();
|
||||
|
||||
if (Danbooru.meta("always-resize-images") === "true") {
|
||||
$("#image-resize-to-window-link").click();
|
||||
@@ -606,6 +607,32 @@
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.Post.initialize_replace_image_dialog = function() {
|
||||
$("#replace-image-dialog").dialog({
|
||||
autoOpen: false,
|
||||
width: 700,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Submit": function() {
|
||||
$("#replace-image-dialog form").submit();
|
||||
$(this).dialog("close");
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#replace-image-dialog form').submit(function() {
|
||||
$('#replace-image-dialog').dialog('close');
|
||||
});
|
||||
|
||||
$("#replace-image").click(function(e) {
|
||||
e.preventDefault();
|
||||
$("#replace-image-dialog").dialog("open");
|
||||
});
|
||||
};
|
||||
})();
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
11
app/views/moderator/post/posts/_replace.html.erb
Normal file
11
app/views/moderator/post/posts/_replace.html.erb
Normal file
@@ -0,0 +1,11 @@
|
||||
<%= simple_form_for(@post, url: replace_moderator_post_post_path, method: :post) do |f| %>
|
||||
<h1>Replace Image</h1>
|
||||
|
||||
<p>
|
||||
Delete the current image and replace it with another one, keeping
|
||||
everything else in the post intact. This is meant for upgrading
|
||||
lower-quality images, such as image samples, to higher-quality versions.
|
||||
</p>
|
||||
|
||||
<%= f.input :source, label: "New Source", input_html: { value: "" } %>
|
||||
<% end %>
|
||||
5
app/views/moderator/post/posts/replace.html.erb
Normal file
5
app/views/moderator/post/posts/replace.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<div id="c-moderator-post-posts">
|
||||
<div id="a-replace">
|
||||
<%= render "moderator/post/posts/replace" %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -55,6 +55,8 @@
|
||||
<li><%= link_to "Expunge", expunge_moderator_post_post_path(:post_id => post.id), :remote => true, :method => :post, :id => "expunge", :data => {:confirm => "This will permanently delete this post (meaning the file will be deleted). Are you sure you want to delete this post?"} %></li>
|
||||
<% end %>
|
||||
|
||||
<li><%= link_to "Replace Image", replace_moderator_post_post_path(:post_id => post.id), :id => "replace-image" %></li>
|
||||
|
||||
<li id="mobile-version-list"><%= link_to "Mobile version", mobile_post_path(post) %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -121,6 +121,10 @@
|
||||
<%= render "post_appeals/new", post_appeal: @post.appeals.new %>
|
||||
</div>
|
||||
|
||||
<div id="replace-image-dialog" class="prose" title="Replace image" style="display: none;">
|
||||
<%= render "moderator/post/posts/replace" %>
|
||||
</div>
|
||||
|
||||
<div id="add-to-pool-dialog" title="Add to pool" style="display: none;">
|
||||
<%= render "pool_elements/new" %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user