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 {
|
||||
padding-top: 2em;
|
||||
.content {
|
||||
float: left;
|
||||
span {
|
||||
display: block;
|
||||
.reason {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
span.text {
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
}
|
||||
.options {
|
||||
float: right;
|
||||
}
|
||||
.clear {
|
||||
clear: both;
|
||||
border-bottom: 1px solid #808080;
|
||||
padding-bottom: 1em;
|
||||
margin-bottom: 1em;
|
||||
form input {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,15 +3,24 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
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)
|
||||
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)))
|
||||
elsif type == 'comment' && !(comment = Comment.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)))
|
||||
elsif type == "comment" && !(comment = Comment.find_by_id(id)).nil?
|
||||
# comment_message is not html_safe. To prevent
|
||||
# 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
|
||||
raw t('report.not_found')
|
||||
raw t("report.not_found")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,26 +7,30 @@
|
|||
- if current_user.admin?
|
||||
= render partial: "admins/admin_bar"
|
||||
.col-md-9
|
||||
%h1
|
||||
= t('report.title')
|
||||
#reports
|
||||
%h1
|
||||
= t("report.title")
|
||||
- @reports.each do |r|
|
||||
.panel.panel-default
|
||||
- username = User.find_by_id(r.user_id).username
|
||||
.content
|
||||
%span.text
|
||||
.panel-heading
|
||||
.reporter.pull-right
|
||||
= raw t("report.reported_label", person: link_to(username, user_profile_path(username)))
|
||||
.title
|
||||
= report_content(r.item_id, r.item_type)
|
||||
%span
|
||||
= raw t('report.reported_label', person: link_to(username, user_profile_path(username)))
|
||||
%span
|
||||
= t('report.reason_label', text: r.text)
|
||||
.options.text-right
|
||||
%span
|
||||
= button_to t('report.review_link'), report_path(r.id, :type => r.item_type),
|
||||
:class => "btn btn-info btn-small",
|
||||
.panel-body
|
||||
.reason
|
||||
= t("report.reason_label", text: r.text)
|
||||
|
||||
= 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
|
||||
%span
|
||||
= button_to t('report.delete_link'), report_path(r.id, :type => r.item_type),
|
||||
:data => { :confirm => t('report.confirm_deletion') },
|
||||
:class => "btn btn-danger btn-small",
|
||||
= button_to t("report.delete_link"), report_path(r.id, type: r.item_type),
|
||||
data: {confirm: t("report.confirm_deletion")},
|
||||
class: "btn pull-right btn-danger btn-small",
|
||||
method: :delete
|
||||
.clear
|
||||
|
||||
|
|
|
|||
|
|
@ -1006,6 +1006,7 @@ en:
|
|||
reason_label: "Reason: %{text}"
|
||||
review_link: "Mark as reviewed"
|
||||
delete_link: "Delete item"
|
||||
reported_user_details: "Details on reported user"
|
||||
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>"
|
||||
status:
|
||||
|
|
|
|||
Loading…
Reference in a new issue