posts: remove ban confirmation page.
Use a dialog instead of a separate page to confirm bans.
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
module Moderator
|
module Moderator
|
||||||
module Post
|
module Post
|
||||||
class PostsController < ApplicationController
|
class PostsController < ApplicationController
|
||||||
before_action :approver_only, :only => [:delete, :move_favorites, :ban, :unban, :confirm_delete, :confirm_move_favorites, :confirm_ban]
|
before_action :approver_only, :only => [:delete, :move_favorites, :ban, :unban, :confirm_delete, :confirm_move_favorites]
|
||||||
before_action :admin_only, :only => [:expunge]
|
before_action :admin_only, :only => [:expunge]
|
||||||
skip_before_action :api_check
|
skip_before_action :api_check
|
||||||
|
|
||||||
respond_to :html, :json, :xml
|
respond_to :html, :json, :xml, :js
|
||||||
|
|
||||||
def confirm_delete
|
def confirm_delete
|
||||||
@post = ::Post.find(params[:id])
|
@post = ::Post.find(params[:id])
|
||||||
@@ -36,29 +36,20 @@ module Moderator
|
|||||||
@post.expunge!
|
@post.expunge!
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirm_ban
|
|
||||||
@post = ::Post.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def ban
|
def ban
|
||||||
@post = ::Post.find(params[:id])
|
@post = ::Post.find(params[:id])
|
||||||
if params[:commit] == "Ban"
|
@post.ban!
|
||||||
@post.ban!
|
flash[:notice] = "Post was banned"
|
||||||
end
|
|
||||||
|
|
||||||
respond_to do |fmt|
|
respond_with(@post)
|
||||||
fmt.html do
|
|
||||||
redirect_to(post_path(@post), :notice => "Post was banned")
|
|
||||||
end
|
|
||||||
|
|
||||||
fmt.js
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def unban
|
def unban
|
||||||
@post = ::Post.find(params[:id])
|
@post = ::Post.find(params[:id])
|
||||||
@post.unban!
|
@post.unban!
|
||||||
redirect_to(post_path(@post), :notice => "Post was unbanned")
|
flash[:notice] = "Post was banned"
|
||||||
|
|
||||||
|
respond_with(@post)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<h1>Ban Post</h1>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<%= PostPresenter.preview(@post, show_deleted: true) %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= form_tag(ban_moderator_post_post_path(@post), :style => "clear: both;", :class => "simple_form") do %>
|
|
||||||
<p>Banning a post will hide it from anyone without a gold level account or higher. You should only ban a post if an artist requested it.</p>
|
|
||||||
|
|
||||||
<%= submit_tag "Ban" %>
|
|
||||||
<%= submit_tag "Cancel" %>
|
|
||||||
<% end %>
|
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<% if post.is_banned? %>
|
<% if post.is_banned? %>
|
||||||
<li id="post-option-unban"><%= link_to "Unban", unban_moderator_post_post_path(post), method: :post, "data-confirm": "Are you sure you want to unban this post?" %></li>
|
<li id="post-option-unban"><%= link_to "Unban", unban_moderator_post_post_path(post), method: :post, "data-confirm": "Are you sure you want to unban this post?" %></li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li id="post-option-ban"><%= link_to "Ban", confirm_ban_moderator_post_post_path(post) %></li>
|
<li id="post-option-ban"><%= link_to "Ban", ban_moderator_post_post_path(post), method: :post, "data-confirm": "Are you sure you want to ban this post?" %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if CurrentUser.is_admin? %>
|
<% if CurrentUser.is_admin? %>
|
||||||
|
|||||||
Reference in New Issue
Block a user