diff --git a/app/helpers/moderation_helper.rb b/app/helpers/moderation_helper.rb index 9bdae5c9..4610f798 100644 --- a/app/helpers/moderation_helper.rb +++ b/app/helpers/moderation_helper.rb @@ -1,2 +1,18 @@ module ModerationHelper + # @param report [Report] + def content_url(report) + target = report.target + case report.type + when 'Reports::Answer' + show_user_answer_path target.user.screen_name, target.id + when 'Reports::Comment' + show_user_answer_path target.answer.user.screen_name, target.answer.id + when 'Reports::Question' + show_user_question_path 'user', target.id + when 'Reports::User' + show_user_profile_path target.screen_name + else + '#' + end + end end diff --git a/app/views/moderation/_moderationbox.html.haml b/app/views/moderation/_moderationbox.html.haml index 49e15755..718e3ebe 100644 --- a/app/views/moderation/_moderationbox.html.haml +++ b/app/views/moderation/_moderationbox.html.haml @@ -14,9 +14,9 @@ = report.target.content .row .col-md-6.col-sm-4.col-xs-6.text-left - %button.btn.btn-primary + %a.btn.btn-primary{href: content_url(report)} View reported - contenttype + = report.type.sub('Reports::', '') .col-md-6.col-sm-8.col-xs-6.text-right %button.btn.btn-success.btn-sm %i.fa.fa-thumbs-up