Improve abuse reports management
* Link to user profile instead of user admin page * One button for remove user and report * Remove user and report with page reloading Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
f9ac553db1
commit
e02b7bf443
4 changed files with 21 additions and 7 deletions
|
@ -116,6 +116,12 @@ $ ->
|
||||||
$('.remove-row').bind 'ajax:success', ->
|
$('.remove-row').bind 'ajax:success', ->
|
||||||
$(this).closest('li').fadeOut()
|
$(this).closest('li').fadeOut()
|
||||||
|
|
||||||
|
$('.js-remove-tr').bind 'ajax:before', ->
|
||||||
|
$(this).hide()
|
||||||
|
|
||||||
|
$('.js-remove-tr').bind 'ajax:success', ->
|
||||||
|
$(this).closest('tr').fadeOut()
|
||||||
|
|
||||||
# Initialize select2 selects
|
# Initialize select2 selects
|
||||||
$('select.select2').select2(width: 'resolve', dropdownAutoWidth: true)
|
$('select.select2').select2(width: 'resolve', dropdownAutoWidth: true)
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,13 @@ class Admin::AbuseReportsController < Admin::ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
AbuseReport.find(params[:id]).destroy
|
abuse_report = AbuseReport.find(params[:id])
|
||||||
|
|
||||||
redirect_to admin_abuse_reports_path, notice: 'Report was removed'
|
if params[:remove_user]
|
||||||
|
abuse_report.user.destroy
|
||||||
|
end
|
||||||
|
|
||||||
|
abuse_report.destroy
|
||||||
|
render nothing: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
- if reporter
|
- if reporter
|
||||||
= link_to reporter.name, [:admin, reporter]
|
= link_to reporter.name, reporter
|
||||||
- else
|
- else
|
||||||
(removed)
|
(removed)
|
||||||
%td
|
%td
|
||||||
|
@ -12,12 +12,15 @@
|
||||||
= abuse_report.message
|
= abuse_report.message
|
||||||
%td
|
%td
|
||||||
- if user
|
- if user
|
||||||
= link_to user.name, [:admin, user]
|
= link_to user.name, user
|
||||||
- else
|
- else
|
||||||
(removed)
|
(removed)
|
||||||
%td
|
%td
|
||||||
- if user
|
- if user
|
||||||
= link_to 'Block', block_admin_user_path(user), data: {confirm: 'USER WILL BE BLOCKED! Are you sure?'}, method: :put, class: "btn btn-xs btn-warning"
|
= link_to 'Remove user & report', admin_abuse_report_path(abuse_report, remove_user: true),
|
||||||
= link_to 'Remove user', [:admin, user], data: { confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-xs btn-remove"
|
data: { confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?" }, remote: true, method: :delete, class: "btn btn-xs btn-remove js-remove-tr"
|
||||||
|
|
||||||
%td
|
%td
|
||||||
|
- if user
|
||||||
|
= link_to 'Block user', block_admin_user_path(user), data: {confirm: 'USER WILL BE BLOCKED! Are you sure?'}, method: :put, class: "btn btn-xs btn-warning"
|
||||||
= link_to 'Remove report', [:admin, abuse_report], method: :delete, class: "btn btn-xs btn-close"
|
= link_to 'Remove report', [:admin, abuse_report], method: :delete, class: "btn btn-xs btn-close"
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
%th Reported at
|
%th Reported at
|
||||||
%th Message
|
%th Message
|
||||||
%th User
|
%th User
|
||||||
%th
|
%th Primary action
|
||||||
%th
|
%th
|
||||||
= render @abuse_reports
|
= render @abuse_reports
|
||||||
= paginate @abuse_reports
|
= paginate @abuse_reports
|
||||||
|
|
Loading…
Reference in a new issue