Merge pull request #589 from Retrospring/feature/be-gone-mod

Adjust moderation views and locales
This commit is contained in:
Karina Kwiatek 2022-07-30 11:06:43 +02:00 committed by GitHub
commit df8964f9cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 62 deletions

View File

@ -1,4 +1,3 @@
= render 'navigation/moderation'
.container-lg.container--main
.row
.col-md-3.col-sm-4.col-xs-12

View File

@ -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

View File

@ -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")

View File

@ -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')

View File

@ -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"

View File

@ -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:

View File

@ -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 <br><strong>%{screen_name}</strong> (#%{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}"