Display all reports and give the ability to review them
This commit is contained in:
parent
6bf47c7ff0
commit
97ee2cd975
2 changed files with 31 additions and 23 deletions
|
|
@ -7,10 +7,7 @@ class ReportController < ApplicationController
|
||||||
before_action :redirect_unless_moderator, except: [:create]
|
before_action :redirect_unless_moderator, except: [:create]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@reports ||= []
|
@reports = Report.where(reviewed: false)
|
||||||
Report.where(reviewed: false).each do |report|
|
|
||||||
@reports << report unless report.item.nil?
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
%h1
|
%h1
|
||||||
= t("report.title")
|
= t("report.title")
|
||||||
- @reports.each do |report|
|
- @reports.each do |report|
|
||||||
|
- if report.item
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
- username = report.user.username
|
- username = report.user.username
|
||||||
.panel-heading
|
.panel-heading
|
||||||
|
|
@ -30,4 +31,14 @@
|
||||||
= button_to t("report.delete_link"), report_path(report.id, type: report.item_type),
|
= button_to t("report.delete_link"), report_path(report.id, type: report.item_type),
|
||||||
data: {confirm: t("report.confirm_deletion")},
|
data: {confirm: t("report.confirm_deletion")},
|
||||||
class: "btn pull-right btn-danger btn-small", method: :delete
|
class: "btn pull-right btn-danger btn-small", method: :delete
|
||||||
|
- else
|
||||||
|
.panel.panel-default
|
||||||
|
- username = report.user.username
|
||||||
|
.panel-heading
|
||||||
|
.reporter.pull-right
|
||||||
|
= raw t("report.reported_label", person: link_to(username, user_profile_path(username)))
|
||||||
|
.title
|
||||||
|
= report_content(report)
|
||||||
|
.panel-body
|
||||||
|
= button_to t("report.review_link"), report_path(report.id, type: report.item_type),
|
||||||
|
class: "btn pull-left btn-info btn-small", method: :put
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue