Fix lints in app/views/moderation

This commit is contained in:
Andreas Nedbal 2020-05-10 11:57:18 +02:00
parent 730b6156ce
commit 3c1d007c5e
6 changed files with 92 additions and 80 deletions

View File

@ -1,4 +1,4 @@
%a.btn.btn-default.btn-block{href: moderation_priority_path(user.id)} %a.btn.btn-default.btn-block{ href: moderation_priority_path(user.id) }
View reports relating to user View reports relating to user
%a.btn.btn-default.btn-block{href: moderation_ip_path(user.id)} %a.btn.btn-default.btn-block{ href: moderation_ip_path(user.id) }
View users with same IP View users with same IP

View File

@ -0,0 +1,29 @@
- if report.moderation_comments.all.count.zero?
= t 'views.answerbox.no_comment'
- else
%ul.comment__container
- report.moderation_comments.order(:created_at).each do |comment|
%li.comment{ data: { comment_id: comment.id } }
.media
.pull-left
%img.comment__user-avatar.avatar-sm{ src: comment.user.profile_picture.url(:medium) }
.media-body
%h6.media-heading.comment__user
= user_screen_name comment.user
%span.text-muted{ title: comment.created_at, data: { toggle: :tooltip, placement: :right } }
= time_ago_in_words(comment.created_at)
ago
- if comment.user == current_user
.pull-right
.btn-group
%button.btn.btn-link.btn-sm.dropdown-toggle{ data: { toggle: :dropdown }, aria: { expanded: false } }
%span.caret
.dropdown-menu.dropdown-menu-right{ role: :menu }
%a.dropdown-item.text-danger{ href: '#', tabindex: -1, data: { action: 'mod-comment-destroy', id: comment.id } }
%i.fa.fa-trash-o
= t 'views.actions.delete'
.comment__content
= comment.content
.form-group.has-feedback{ name: 'mod-comment-new-group', data: { id: report.id } }
%input.form-control.comments--box{ type: :text, placeholder: t('views.placeholder.comment'), name: 'mod-comment-new', data: { id: report.id } }
%span.text-muted.form-control-feedback.comments--count{ id: "mod-comment-charcount-#{report.id}" } 160

View File

@ -1,28 +0,0 @@
- if report.moderation_comments.all.count == 0
= t 'views.answerbox.no_comment'
- else
%ul.comment__container
- report.moderation_comments.order(:created_at).each do |comment|
%li.comment{data: { comment_id: comment.id }}
.media
.pull-left
%img.comment__user-avatar.avatar-sm{src: comment.user.profile_picture.url(:medium)}
.media-body
%h6.media-heading.comment__user
= user_screen_name comment.user
%span.text-muted{title: comment.created_at, data: { toggle: :tooltip, placement: :right }}
= "#{time_ago_in_words(comment.created_at)} ago"
- if comment.user == current_user
.pull-right
.btn-group
%button.btn.btn-link.btn-sm.dropdown-toggle{data: { toggle: :dropdown }, aria: { expanded: :false }}
%span.caret
.dropdown-menu.dropdown-menu-right{role: :menu}
%a.dropdown-item.text-danger{href: '#', tabindex: -1, data: { action: 'mod-comment-destroy', id: comment.id }}
%i.fa.fa-trash-o
= t 'views.actions.delete'
.comment__content
= comment.content
.form-group.has-feedback{name: 'mod-comment-new-group', data: { id: report.id }}
%input.form-control.comments--box{type: :text, placeholder: t('views.placeholder.comment'), name: 'mod-comment-new', data: { id: report.id }}
%span.text-muted.form-control-feedback.comments--count{id: "mod-comment-charcount-#{report.id}"} 160

View File

@ -0,0 +1,55 @@
- 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
- 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: show_user_profile_path(report.target.user.screen_name) }
= t('views.moderation.moderationbox.view', content: t('views.general.user'))
%a.btn.btn-primary{ href: moderation_priority_path(report.target.user.id) }
Reports
%a.btn.btn-primary{ href: moderation_ip_path(report.target.user.id) }
IP
.col-md-4.col-sm-4.col-xs-4.text-right
%span.mod-count{ id: "mod-count-#{report.id}" }
= report.votes
.btn-group
%button.btn.btn-success.btn-sm{ type: :button,
name: 'mod-vote',
disabled: current_user.report_x_voted?(report, true) ? 'disabled' : nil,
data: { id: report.id, action: current_user.report_voted?(report) ? 'unvote' : 'vote', vote_type: 'upvote' } }
%i.fa.fa-thumbs-up
%button.btn.btn-danger.btn-sm{ type: :button,
name: 'mod-vote',
disabled: current_user.report_x_voted?(report, false) ? 'disabled' : nil,
data: { id: report.id, action: current_user.report_voted?(report) ? 'unvote' : 'vote', vote_type: 'downvote' } }
%i.fa.fa-thumbs-down
%button.btn.btn-primary.btn-sm{ type: :button, name: 'mod-comments', data: { id: report.id, state: :hidden } }
%i.fa.fa-comments
%span{ id: "mod-comment-count-#{report.id}" }= report.moderation_comments.all.count
%button.btn.btn-default.btn-sm{ type: :button, name: 'mod-delete-report', data: { id: report.id } }
%i.fa.fa-trash-o
.card-footer{ id: "mod-comments-section-#{report.id}", style: 'display: none' }
%div{ id: "mod-comments-#{report.id}" }= render 'moderation/discussion', report: report

View File

@ -1,46 +0,0 @@
- unless report.nil? or report.target.nil? or report.user.nil? or 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
- else
= report.target.content
%p
%b= t 'views.moderation.moderationbox.reason'
%br
- if report.reason.nil? or 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 and not report.target.user.nil?
%a.btn.btn-primary{href: show_user_profile_path(report.target.user.screen_name)}
= t('views.moderation.moderationbox.view', content: t('views.general.user'))
%a.btn.btn-primary{href: moderation_priority_path(report.target.user.id)}
Reports
%a.btn.btn-primary{href: moderation_ip_path(report.target.user.id)}
IP
.col-md-4.col-sm-4.col-xs-4.text-right
%span.mod-count{id: "mod-count-#{report.id}"}
= report.votes
.btn-group
%button.btn.btn-success.btn-sm{type: :button, name: "mod-vote", disabled: current_user.report_x_voted?(report, true) ? 'disabled' : nil, data: { id: report.id, action: current_user.report_voted?(report) ? 'unvote' : 'vote', vote_type: 'upvote' }}
%i.fa.fa-thumbs-up
%button.btn.btn-danger.btn-sm{type: :button, name: "mod-vote", disabled: current_user.report_x_voted?(report, false) ? 'disabled' : nil, data: { id: report.id, action: current_user.report_voted?(report) ? 'unvote' : 'vote', vote_type: 'downvote' }}
%i.fa.fa-thumbs-down
%button.btn.btn-primary.btn-sm{type: :button, name: 'mod-comments', data: { id: report.id, state: :hidden }}
%i.fa.fa-comments
%span{id: "mod-comment-count-#{report.id}"}= report.moderation_comments.all.count
%button.btn.btn-default.btn-sm{type: :button, name: "mod-delete-report", data: { id: report.id }}
%i.fa.fa-trash-o
.card-footer{id: "mod-comments-section-#{report.id}", style: 'display: none'}
%div{id: "mod-comments-#{report.id}"}= render 'moderation/discussion', report: report

View File

@ -1,14 +1,16 @@
.card.h-100.userbox .card.h-100.userbox
%img.userbox__header{src: user.profile_header.url(:mobile)} %img.userbox__header{ src: user.profile_header.url(:mobile) }
.card-body .card-body
%img.userbox__avatar{src: user.profile_picture.url(:small)} %img.userbox__avatar{ src: user.profile_picture.url(:small) }
%a.profile__name{href: show_user_profile_path(user.screen_name)} %a.profile__name{ href: show_user_profile_path(user.screen_name) }
- unless user.display_name.blank? - unless user.display_name.blank?
.profile__display-name .profile__display-name
= user.display_name = user.display_name
.profile__screen-name
= user.screen_name
.row .row
.col-md-12.col-sm-12.col-xs-12 .col-md-12.col-sm-12.col-xs-12
- unless count.nil? - if count.positive?
%h4.entry-text.text-center#asked-count %h4.entry-text.text-center#asked-count
= count = count
= 'Report'.pluralize(count) = 'Report'.pluralize(count)