diff --git a/app/views/layouts/moderation.haml b/app/views/layouts/moderation.haml index 22a48339..2d600a12 100644 --- a/app/views/layouts/moderation.haml +++ b/app/views/layouts/moderation.haml @@ -1,4 +1,3 @@ -= render 'navigation/moderation' .container-lg.container--main .row .col-md-3.col-sm-4.col-xs-12 diff --git a/app/views/moderation/_moderationbox.haml b/app/views/moderation/_moderationbox.haml index ddcc5656..583d8c9a 100644 --- a/app/views/moderation/_moderationbox.haml +++ b/app/views/moderation/_moderationbox.haml @@ -1,33 +1,32 @@ -- unless report.nil? || report.target.nil? || report.user.nil? || report.type.nil? - .card.moderationbox{ data: { id: report.id } } - .card-header - %img.avatar-sm{ src: report.user.profile_picture.url(:medium) } - = raw t('views.moderation.moderationbox.reported', - user: user_screen_name(report.user), - content: report.type.sub('Reports::', ''), - time: time_tooltip(report)) - .card-body - %p - - if report.type == 'Reports::User' - = user_screen_name report.target +.card.moderationbox{ data: { id: report.id } } + .card-header + %img.avatar-sm{ src: report.user.profile_picture.url(:medium) } + = t(".reported_html", + user: user_screen_name(report.user), + content: report.type.sub("Reports::", ""), + time: time_tooltip(report)) + .card-body + %p + - if report.type == "Reports::User" + = user_screen_name report.target + - else + = report.target.content + %p + %b= t(".reason.heading") + %br + - if report.reason.nil? || report.reason.strip.blank? + = t(".reason.none") - else - = report.target.content - %p - %b= t 'views.moderation.moderationbox.reason' - %br - - if report.reason.nil? || report.reason.strip.blank? - No reason provided - - else - - report.reason.lines.each do |reason| - - next if reason.strip.blank? - = reason.strip - .row - .col-md-8.col-sm-8.col-xs-8.text-left - %a.btn.btn-primary{ href: content_url(report) } - = t('views.moderation.moderationbox.view', content: report.type.sub('Reports::', '')) - - if report.target.respond_to?(:user) && report.target.user - %a.btn.btn-primary{ href: user_path(report.target.user) } - = t('views.moderation.moderationbox.view', content: t('views.general.user')) - .col-md-4.col-sm-4.col-xs-4.text-right - %button.btn.btn-default.btn-sm{ type: :button, name: 'mod-delete-report', data: { id: report.id } } - %i.fa.fa-trash-o + - report.reason.lines.each do |reason| + - next if reason.strip.blank? + = reason.strip + .row + .col-md-8.col-sm-8.col-xs-8.text-left + %a.btn.btn-primary{ href: content_url(report) } + = t(".view", content: report.type.sub("Reports::", "")) + - if report.target.respond_to?(:user) && report.target.user + %a.btn.btn-primary{ href: user_path(report.target.user) } + = t(".view", content: t("activerecord.models.user.one")) + .col-md-4.col-sm-4.col-xs-4.text-right + %button.btn.btn-default.btn-sm{ type: :button, name: "mod-delete-report", data: { id: report.id } } + %i.fa.fa-trash-o diff --git a/app/views/moderation/index.haml b/app/views/moderation/index.haml index 0b73d230..0bcb623a 100644 --- a/app/views/moderation/index.haml +++ b/app/views/moderation/index.haml @@ -1,11 +1,11 @@ #reports - @reports.each do |r| - = render 'moderation/moderationbox', report: r + = render "moderation/moderationbox", report: r - unless @reports.count.zero? - = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @reports_last_id, permitted_params: %i[type] + = render "shared/cursored_pagination_dummy", more_data_available: @more_data_available, last_id: @reports_last_id, permitted_params: %i[type] - if @more_data_available .d-flex.justify-content-center.justify-content-sm-start %button.btn.btn-light#load-more-btn{ type: :button, data: { last_id: @reports_last_id } } - = t 'views.actions.load' + = t("voc.load") diff --git a/app/views/navigation/_moderation.haml b/app/views/navigation/_moderation.haml deleted file mode 100644 index 007766cc..00000000 --- a/app/views/navigation/_moderation.haml +++ /dev/null @@ -1,12 +0,0 @@ -%nav.navbar.navbar-light.bg-light.navbar-static-top.j2-navbar.d-flex.d-sm-none{ role: :navigation } - %a.navbar-brand{ href: moderation_path } Moderation - %button.navbar-toggler{ data: { target: '#j2-tl-navbar-collapse', toggle: :collapse }, type: :button } - %span.sr-only Toggle navigation - %span.navbar-toggler-icon - .collapse.navbar-collapse#j2-tl-navbar-collapse - %ul.nav.navbar-nav - = nav_entry t('views.moderation.tabs.all'), moderation_path - = nav_entry t('views.general.answer').pluralize(2), moderation_path('answer') - = nav_entry t('views.general.comment').pluralize(2), moderation_path('comment') - = nav_entry t('views.general.user').pluralize(2), moderation_path('user') - = nav_entry t('views.general.question').pluralize(2), moderation_path('question') diff --git a/app/views/tabs/_moderation.haml b/app/views/tabs/_moderation.haml index a0ae3666..5b2ccb89 100644 --- a/app/views/tabs/_moderation.haml +++ b/app/views/tabs/_moderation.haml @@ -1,9 +1,9 @@ -.card.d-none.d-sm-block +.card .list-group - = list_group_item t('views.moderation.tabs.all'), moderation_path - = list_group_item t('views.general.answer').pluralize(2), moderation_path('answer') - = list_group_item t('views.general.comment').pluralize(2), moderation_path('comment') - = list_group_item t('views.general.user').pluralize(2), moderation_path('user') - = list_group_item t('views.general.question').pluralize(2), moderation_path('question') + = list_group_item t(".all"), moderation_path + = list_group_item t(".answers"), moderation_path("answer") + = list_group_item t(".comments"), moderation_path("comment") + = list_group_item t(".users"), moderation_path("user") + = list_group_item t(".questions"), moderation_path("question") -.d-none.d-sm-block= render 'shared/links' +.d-none.d-sm-block= render "shared/links" diff --git a/config/locales/en.yml b/config/locales/en.yml index e1b03205..dc8cd92d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -58,13 +58,6 @@ en: destroy: "Logout" create: "Sign in" new: "Sign up" - moderation: - tabs: - all: "All reports" - moderationbox: - reported: "%{user} reported a %{content} %{time} ago" - reason: "Reason:" - view: "View reported %{content}" question: title: "This question was not in your inbox? Answer it here!" navigation: diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index 3b838fde..5e31e844 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -439,6 +439,12 @@ en: terms: "Terms of Service" privacy: "Privacy Policy" tabs: + moderation: + all: "All reports" + answers: :activerecord.models.answer.other + comments: :activerecord.models.comment.other + users: :activerecord.models.user.other + questions: :activerecord.models.question.other notifications: all: "All notifications" new: "New notifications" @@ -463,3 +469,9 @@ en: title_html: "Viewing inbox for
%{screen_name} (#%{user_id})" index: title: "Inbox for %{user}" + moderationbox: + reported_html: "%{user} reported a %{content} %{time} ago" + reason: + heading: "Reason:" + none: "No reason provided" + view: "View reported %{content}"