diff --git a/app/assets/stylesheets/report.scss b/app/assets/stylesheets/report.scss index d964b55cd..30e6f32eb 100644 --- a/app/assets/stylesheets/report.scss +++ b/app/assets/stylesheets/report.scss @@ -1,21 +1,9 @@ #reports { padding-top: 2em; - .content { - float: left; - span { - display: block; - } - span.text { - padding-bottom: 1em; - } + .reason { + padding-bottom: 20px; } - .options { - float: right; - } - .clear { - clear: both; - border-bottom: 1px solid #808080; - padding-bottom: 1em; - margin-bottom: 1em; + form input { + margin-right: 5px; } } diff --git a/app/helpers/report_helper.rb b/app/helpers/report_helper.rb index 2170e3665..99533489e 100644 --- a/app/helpers/report_helper.rb +++ b/app/helpers/report_helper.rb @@ -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 diff --git a/app/views/report/index.html.haml b/app/views/report/index.html.haml index b13031cd7..c8745fcec 100644 --- a/app/views/report/index.html.haml +++ b/app/views/report/index.html.haml @@ -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| - - username = User.find_by_id(r.user_id).username - .content - %span.text - = 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.panel-default + - username = User.find_by_id(r.user_id).username + .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) + .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 + diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 30446b96f..7b30fee8f 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -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: "The post/comment was not found. It seems that it was deleted by the user!" status: