diff --git a/app/controllers/moderator/post/posts_controller.rb b/app/controllers/moderator/post/posts_controller.rb index c8a2e5382..bd2411d76 100644 --- a/app/controllers/moderator/post/posts_controller.rb +++ b/app/controllers/moderator/post/posts_controller.rb @@ -1,7 +1,7 @@ module Moderator module Post class PostsController < ApplicationController - before_filter :moderator_only, :only => [:delete, :undelete, :ban, :unban, :confirm_delete, :confirm_ban] + before_filter :moderator_only, :only => [:delete, :undelete, :move_favorites, :ban, :unban, :confirm_delete, :confirm_move_favorites, :confirm_ban] before_filter :admin_only, :only => [:expunge] rescue_from ::PostFlag::Error, :with => :rescue_exception @@ -23,6 +23,18 @@ module Moderator @post.undelete! end + def confirm_move_favorites + @post = ::Post.find(params[:id]) + end + + def move_favorites + @post = ::Post.find(params[:id]) + if params[:commit] == "Submit" + @post.give_favorites_to_parent + end + redirect_to(post_path(@post)) + end + def expunge @post = ::Post.find(params[:id]) @post.expunge! diff --git a/app/views/moderator/post/posts/confirm_move_favorites.html.erb b/app/views/moderator/post/posts/confirm_move_favorites.html.erb new file mode 100644 index 000000000..a734d3a7b --- /dev/null +++ b/app/views/moderator/post/posts/confirm_move_favorites.html.erb @@ -0,0 +1,12 @@ +
This will move all the post's favorites to its parent post. Are you sure?
+ +<%= form_tag(move_favorites_moderator_post_post_path, :style => "clear: both;", :class => "simple_form") do %> + <%= submit_tag "Submit" %> + <%= submit_tag "Cancel" %> +<% end %> diff --git a/app/views/posts/partials/show/_options.html.erb b/app/views/posts/partials/show/_options.html.erb index 172ee1fec..ef7bc99e9 100644 --- a/app/views/posts/partials/show/_options.html.erb +++ b/app/views/posts/partials/show/_options.html.erb @@ -31,6 +31,9 @@ <% if CurrentUser.can_approve_posts? %> <% if post.is_deleted? %>