mirror of
https://github.com/funamitech/mastodon
synced 2024-12-12 05:39:02 +09:00
Extract partials from admin/reports/show
view (#27427)
This commit is contained in:
parent
8d0f12f776
commit
33b073f77d
24
app/views/admin/reports/_comment.html.haml
Normal file
24
app/views/admin/reports/_comment.html.haml
Normal file
@ -0,0 +1,24 @@
|
||||
- if report.account.instance_actor?
|
||||
%p= t('admin.reports.comment_description_html', name: content_tag(:strong, site_hostname, class: 'username'))
|
||||
- elsif report.account.local?
|
||||
%p= t('admin.reports.comment_description_html', name: content_tag(:strong, report.account.username, class: 'username'))
|
||||
- else
|
||||
%p= t('admin.reports.comment_description_html', name: t('admin.reports.remote_user_placeholder', instance: report.account.domain))
|
||||
.report-notes
|
||||
.report-notes__item
|
||||
- if report.account.local? && !report.account.instance_actor?
|
||||
= image_tag report.account.avatar.url, class: 'report-notes__item__avatar'
|
||||
- else
|
||||
= image_tag(full_asset_url('avatars/original/missing.png', skip_pipeline: true), class: 'report-notes__item__avatar')
|
||||
.report-notes__item__header
|
||||
%span.username
|
||||
- if report.account.instance_actor?
|
||||
= site_hostname
|
||||
- elsif report.account.local?
|
||||
= link_to report.account.username, admin_account_path(report.account_id)
|
||||
- else
|
||||
= link_to report.account.domain, admin_instance_path(report.account.domain)
|
||||
%time.relative-formatted{ datetime: report.created_at.iso8601 }
|
||||
= l report.created_at.to_date
|
||||
.report-notes__item__content
|
||||
= simple_format(h(report.comment))
|
46
app/views/admin/reports/_header_card.html.haml
Normal file
46
app/views/admin/reports/_header_card.html.haml
Normal file
@ -0,0 +1,46 @@
|
||||
.report-header__card
|
||||
.account-card
|
||||
.account-card__header
|
||||
= image_tag report.target_account.header.url, alt: ''
|
||||
.account-card__title
|
||||
.account-card__title__avatar
|
||||
= image_tag report.target_account.avatar.url, alt: ''
|
||||
.display-name
|
||||
%bdi
|
||||
%strong.emojify.p-name= display_name(report.target_account, custom_emojify: true)
|
||||
%span
|
||||
= acct(report.target_account)
|
||||
= fa_icon('lock') if report.target_account.locked?
|
||||
- if report.target_account.note.present?
|
||||
.account-card__bio.emojify
|
||||
= prerender_custom_emojis(account_bio_format(report.target_account), report.target_account.emojis)
|
||||
.account-card__actions
|
||||
.account-card__counters
|
||||
.account-card__counters__item
|
||||
= friendly_number_to_human report.target_account.statuses_count
|
||||
%small= t('accounts.posts', count: report.target_account.statuses_count).downcase
|
||||
.account-card__counters__item
|
||||
= friendly_number_to_human report.target_account.followers_count
|
||||
%small= t('accounts.followers', count: report.target_account.followers_count).downcase
|
||||
.account-card__counters__item
|
||||
= friendly_number_to_human report.target_account.following_count
|
||||
%small= t('accounts.following', count: report.target_account.following_count).downcase
|
||||
.account-card__actions__button
|
||||
= link_to t('admin.reports.view_profile'), admin_account_path(report.target_account_id), class: 'button'
|
||||
.report-header__details.report-header__details--horizontal
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.accounts.joined')
|
||||
.report-header__details__item__content
|
||||
%time.time-ago{ datetime: report.target_account.created_at.iso8601, title: l(report.target_account.created_at) }= l report.target_account.created_at
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('accounts.last_active')
|
||||
.report-header__details__item__content
|
||||
- if report.target_account.last_status_at.present?
|
||||
%time.time-ago{ datetime: report.target_account.last_status_at.to_date.iso8601, title: l(report.target_account.last_status_at.to_date) }= l report.target_account.last_status_at
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.accounts.strikes')
|
||||
.report-header__details__item__content
|
||||
= report.target_account.previous_strikes_count
|
53
app/views/admin/reports/_header_details.html.haml
Normal file
53
app/views/admin/reports/_header_details.html.haml
Normal file
@ -0,0 +1,53 @@
|
||||
.report-header__details
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.created_at')
|
||||
.report-header__details__item__content
|
||||
%time.formatted{ datetime: report.created_at.iso8601 }
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.reported_by')
|
||||
.report-header__details__item__content
|
||||
- if report.account.instance_actor?
|
||||
= site_hostname
|
||||
- elsif report.account.local?
|
||||
= admin_account_link_to report.account
|
||||
- else
|
||||
= report.account.domain
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.status')
|
||||
.report-header__details__item__content
|
||||
- if report.action_taken?
|
||||
= t('admin.reports.resolved')
|
||||
- else
|
||||
= t('admin.reports.unresolved')
|
||||
- unless report.target_account.local?
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.forwarded')
|
||||
.report-header__details__item__content
|
||||
- if report.forwarded?
|
||||
= t('simple_form.yes')
|
||||
- else
|
||||
= t('simple_form.no')
|
||||
- if report.action_taken_by_account.present?
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.action_taken_by')
|
||||
.report-header__details__item__content
|
||||
= admin_account_link_to report.action_taken_by_account
|
||||
- else
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.assigned')
|
||||
.report-header__details__item__content
|
||||
- if report.assigned_account.nil?
|
||||
= t 'admin.reports.no_one_assigned'
|
||||
- else
|
||||
= admin_account_link_to report.assigned_account
|
||||
—
|
||||
- if report.assigned_account != current_user.account
|
||||
= table_link_to 'user', t('admin.reports.assign_to_self'), assign_to_self_admin_report_path(report), method: :post
|
||||
- elsif !report.assigned_account.nil?
|
||||
= table_link_to 'trash', t('admin.reports.unassign'), unassign_admin_report_path(report), method: :post
|
@ -8,106 +8,8 @@
|
||||
= link_to t('admin.reports.mark_as_unresolved'), reopen_admin_report_path(@report), method: :post, class: 'button'
|
||||
|
||||
.report-header
|
||||
.report-header__card
|
||||
.account-card
|
||||
.account-card__header
|
||||
= image_tag @report.target_account.header.url, alt: ''
|
||||
.account-card__title
|
||||
.account-card__title__avatar
|
||||
= image_tag @report.target_account.avatar.url, alt: ''
|
||||
.display-name
|
||||
%bdi
|
||||
%strong.emojify.p-name= display_name(@report.target_account, custom_emojify: true)
|
||||
%span
|
||||
= acct(@report.target_account)
|
||||
= fa_icon('lock') if @report.target_account.locked?
|
||||
- if @report.target_account.note.present?
|
||||
.account-card__bio.emojify
|
||||
= prerender_custom_emojis(account_bio_format(@report.target_account), @report.target_account.emojis)
|
||||
.account-card__actions
|
||||
.account-card__counters
|
||||
.account-card__counters__item
|
||||
= friendly_number_to_human @report.target_account.statuses_count
|
||||
%small= t('accounts.posts', count: @report.target_account.statuses_count).downcase
|
||||
.account-card__counters__item
|
||||
= friendly_number_to_human @report.target_account.followers_count
|
||||
%small= t('accounts.followers', count: @report.target_account.followers_count).downcase
|
||||
.account-card__counters__item
|
||||
= friendly_number_to_human @report.target_account.following_count
|
||||
%small= t('accounts.following', count: @report.target_account.following_count).downcase
|
||||
.account-card__actions__button
|
||||
= link_to t('admin.reports.view_profile'), admin_account_path(@report.target_account_id), class: 'button'
|
||||
.report-header__details.report-header__details--horizontal
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.accounts.joined')
|
||||
.report-header__details__item__content
|
||||
%time.time-ago{ datetime: @report.target_account.created_at.iso8601, title: l(@report.target_account.created_at) }= l @report.target_account.created_at
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('accounts.last_active')
|
||||
.report-header__details__item__content
|
||||
- if @report.target_account.last_status_at.present?
|
||||
%time.time-ago{ datetime: @report.target_account.last_status_at.to_date.iso8601, title: l(@report.target_account.last_status_at.to_date) }= l @report.target_account.last_status_at
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.accounts.strikes')
|
||||
.report-header__details__item__content
|
||||
= @report.target_account.previous_strikes_count
|
||||
|
||||
.report-header__details
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.created_at')
|
||||
.report-header__details__item__content
|
||||
%time.formatted{ datetime: @report.created_at.iso8601 }
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.reported_by')
|
||||
.report-header__details__item__content
|
||||
- if @report.account.instance_actor?
|
||||
= site_hostname
|
||||
- elsif @report.account.local?
|
||||
= admin_account_link_to @report.account
|
||||
- else
|
||||
= @report.account.domain
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.status')
|
||||
.report-header__details__item__content
|
||||
- if @report.action_taken?
|
||||
= t('admin.reports.resolved')
|
||||
- else
|
||||
= t('admin.reports.unresolved')
|
||||
- unless @report.target_account.local?
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.forwarded')
|
||||
.report-header__details__item__content
|
||||
- if @report.forwarded?
|
||||
= t('simple_form.yes')
|
||||
- else
|
||||
= t('simple_form.no')
|
||||
- if @report.action_taken_by_account.present?
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.action_taken_by')
|
||||
.report-header__details__item__content
|
||||
= admin_account_link_to @report.action_taken_by_account
|
||||
- else
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.assigned')
|
||||
.report-header__details__item__content
|
||||
- if @report.assigned_account.nil?
|
||||
= t 'admin.reports.no_one_assigned'
|
||||
- else
|
||||
= admin_account_link_to @report.assigned_account
|
||||
—
|
||||
- if @report.assigned_account != current_user.account
|
||||
= table_link_to 'user', t('admin.reports.assign_to_self'), assign_to_self_admin_report_path(@report), method: :post
|
||||
- elsif !@report.assigned_account.nil?
|
||||
= table_link_to 'trash', t('admin.reports.unassign'), unassign_admin_report_path(@report), method: :post
|
||||
= render 'admin/reports/header_card', report: @report
|
||||
= render 'admin/reports/header_details', report: @report
|
||||
|
||||
%hr.spacer
|
||||
|
||||
@ -118,33 +20,7 @@
|
||||
= react_admin_component :report_reason_selector, id: @report.id, category: @report.category, rule_ids: @report.rule_ids&.map(&:to_s), disabled: @report.action_taken?
|
||||
|
||||
- if @report.comment.present?
|
||||
- if @report.account.instance_actor?
|
||||
%p= t('admin.reports.comment_description_html', name: content_tag(:strong, site_hostname, class: 'username'))
|
||||
- elsif @report.account.local?
|
||||
%p= t('admin.reports.comment_description_html', name: content_tag(:strong, @report.account.username, class: 'username'))
|
||||
- else
|
||||
%p= t('admin.reports.comment_description_html', name: t('admin.reports.remote_user_placeholder', instance: @report.account.domain))
|
||||
|
||||
.report-notes
|
||||
.report-notes__item
|
||||
- if @report.account.local? && !@report.account.instance_actor?
|
||||
= image_tag @report.account.avatar.url, class: 'report-notes__item__avatar'
|
||||
- else
|
||||
= image_tag(full_asset_url('avatars/original/missing.png', skip_pipeline: true), class: 'report-notes__item__avatar')
|
||||
|
||||
.report-notes__item__header
|
||||
%span.username
|
||||
- if @report.account.instance_actor?
|
||||
= site_hostname
|
||||
- elsif @report.account.local?
|
||||
= link_to @report.account.username, admin_account_path(@report.account_id)
|
||||
- else
|
||||
= link_to @report.account.domain, admin_instance_path(@report.account.domain)
|
||||
%time.relative-formatted{ datetime: @report.created_at.iso8601 }
|
||||
= l @report.created_at.to_date
|
||||
|
||||
.report-notes__item__content
|
||||
= simple_format(h(@report.comment))
|
||||
= render 'admin/reports/comment', report: @report
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user