Report tab; bootstrap3 compatible, add user detail btn
The reported_user_details button will redirect you to admin user_search. This can be useful if the podmin wants to lock, unlock or delete the account which is responsible for the reported post Signed-off-by: Lukas Matt <lukas@zauberstuhl.de>
This commit is contained in:
parent
cc631372a1
commit
d1e3e568b9
4 changed files with 42 additions and 40 deletions
|
|
@ -1,21 +1,9 @@
|
||||||
#reports {
|
#reports {
|
||||||
padding-top: 2em;
|
padding-top: 2em;
|
||||||
.content {
|
.reason {
|
||||||
float: left;
|
padding-bottom: 20px;
|
||||||
span {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
span.text {
|
|
||||||
padding-bottom: 1em;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.options {
|
form input {
|
||||||
float: right;
|
margin-right: 5px;
|
||||||
}
|
|
||||||
.clear {
|
|
||||||
clear: both;
|
|
||||||
border-bottom: 1px solid #808080;
|
|
||||||
padding-bottom: 1em;
|
|
||||||
margin-bottom: 1em;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,24 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
module ReportHelper
|
module ReportHelper
|
||||||
|
def get_reported_guid(id, type)
|
||||||
|
if type == "post"
|
||||||
|
Post.where(id: id).first.author.guid
|
||||||
|
elsif type == "comment"
|
||||||
|
Comment.where(id: id).first.author.guid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def report_content(id, type)
|
def report_content(id, type)
|
||||||
if type == 'post' && !(post = Post.find_by_id(id)).nil?
|
if type == "post" && !(post = Post.find_by_id(id)).nil?
|
||||||
raw t('report.post_label', title: link_to(post_page_title(post), post_path(id)))
|
raw t("report.post_label", title: link_to(post_page_title(post), post_path(id)))
|
||||||
elsif type == 'comment' && !(comment = Comment.find_by_id(id)).nil?
|
elsif type == "comment" && !(comment = Comment.find_by_id(id)).nil?
|
||||||
# comment_message is not html_safe. To prevent
|
# comment_message is not html_safe. To prevent
|
||||||
# cross-site-scripting we have to escape html
|
# cross-site-scripting we have to escape html
|
||||||
raw t('report.comment_label', data: link_to(h(comment_message(comment)), post_path(comment.post.id, anchor: comment.guid)))
|
raw t("report.comment_label", data: link_to(
|
||||||
|
h(comment_message(comment)), post_path(comment.post.id, anchor: comment.guid)))
|
||||||
else
|
else
|
||||||
raw t('report.not_found')
|
raw t("report.not_found")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,26 +7,30 @@
|
||||||
- if current_user.admin?
|
- if current_user.admin?
|
||||||
= render partial: "admins/admin_bar"
|
= render partial: "admins/admin_bar"
|
||||||
.col-md-9
|
.col-md-9
|
||||||
%h1
|
|
||||||
= t('report.title')
|
|
||||||
#reports
|
#reports
|
||||||
|
%h1
|
||||||
|
= t("report.title")
|
||||||
- @reports.each do |r|
|
- @reports.each do |r|
|
||||||
- username = User.find_by_id(r.user_id).username
|
.panel.panel-default
|
||||||
.content
|
- username = User.find_by_id(r.user_id).username
|
||||||
%span.text
|
.panel-heading
|
||||||
= report_content(r.item_id, r.item_type)
|
.reporter.pull-right
|
||||||
%span
|
= raw t("report.reported_label", person: link_to(username, user_profile_path(username)))
|
||||||
= raw t('report.reported_label', person: link_to(username, user_profile_path(username)))
|
.title
|
||||||
%span
|
= report_content(r.item_id, r.item_type)
|
||||||
= t('report.reason_label', text: r.text)
|
.panel-body
|
||||||
.options.text-right
|
.reason
|
||||||
%span
|
= t("report.reason_label", text: r.text)
|
||||||
= button_to t('report.review_link'), report_path(r.id, :type => r.item_type),
|
|
||||||
:class => "btn btn-info btn-small",
|
= button_to t("report.reported_user_details"),
|
||||||
|
user_search_path(admins_controller_user_search: {guid: get_reported_guid(r.item_id,
|
||||||
|
r.item_type)}), class: "btn pull-left btn-info btn-small",
|
||||||
|
method: :post
|
||||||
|
= button_to t("report.review_link"), report_path(r.id, type: r.item_type),
|
||||||
|
class: "btn pull-left btn-info btn-small",
|
||||||
method: :put
|
method: :put
|
||||||
%span
|
= button_to t("report.delete_link"), report_path(r.id, type: r.item_type),
|
||||||
= button_to t('report.delete_link'), report_path(r.id, :type => r.item_type),
|
data: {confirm: t("report.confirm_deletion")},
|
||||||
:data => { :confirm => t('report.confirm_deletion') },
|
class: "btn pull-right btn-danger btn-small",
|
||||||
:class => "btn btn-danger btn-small",
|
|
||||||
method: :delete
|
method: :delete
|
||||||
.clear
|
|
||||||
|
|
|
||||||
|
|
@ -1006,6 +1006,7 @@ en:
|
||||||
reason_label: "Reason: %{text}"
|
reason_label: "Reason: %{text}"
|
||||||
review_link: "Mark as reviewed"
|
review_link: "Mark as reviewed"
|
||||||
delete_link: "Delete item"
|
delete_link: "Delete item"
|
||||||
|
reported_user_details: "Details on reported user"
|
||||||
confirm_deletion: "Are you sure to delete the item?"
|
confirm_deletion: "Are you sure to delete the item?"
|
||||||
not_found: "<u>The post/comment was not found. It seems that it was deleted by the user!</u>"
|
not_found: "<u>The post/comment was not found. It seems that it was deleted by the user!</u>"
|
||||||
status:
|
status:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue