diff --git a/app/views/disputes/strikes/_card.html.haml b/app/views/disputes/strikes/_card.html.haml new file mode 100644 index 0000000000..55551cc7d0 --- /dev/null +++ b/app/views/disputes/strikes/_card.html.haml @@ -0,0 +1,38 @@ +.strike-card + - unless strike.none_action? + %p= t "user_mailer.warning.explanation.#{strike.action}", instance: Rails.configuration.x.local_domain + - if strike.text.present? + = linkify(strike.text) + - if strike.report && !strike.report.other? + %p + %strong= t('user_mailer.warning.reason') + = t("user_mailer.warning.categories.#{strike.report.category}") + - if strike.report.violation? && strike.report.rule_ids.present? + %ul.strike-card__rules + - strike.report.rules.each do |rule| + %li + %span.strike-card__rules__text= rule.text + - if strike.status_ids.present? && !strike.status_ids.empty? + %p + %strong= t('user_mailer.warning.statuses') + .strike-card__statuses-list + - status_map = strike.statuses.includes(:application, :media_attachments).index_by(&:id) + - strike.status_ids.each do |status_id| + .strike-card__statuses-list__item + - if (status = status_map[status_id.to_i]) + .one-liner + .emojify= one_line_preview(status) + - status.ordered_media_attachments.each do |media_attachment| + %abbr{ title: media_attachment.description } + = fa_icon 'link' + = media_attachment.file_file_name + .strike-card__statuses-list__item__meta + = link_to ActivityPub::TagManager.instance.url_for(status), target: '_blank', rel: 'noopener noreferrer' do + %time.formatted{ datetime: status.created_at.iso8601, title: l(status.created_at) }= l(status.created_at) + - unless status.application.nil? + · + = status.application.name + - else + .one-liner= t('disputes.strikes.status', id: status_id) + .strike-card__statuses-list__item__meta + = t('disputes.strikes.status_removed') diff --git a/app/views/disputes/strikes/show.html.haml b/app/views/disputes/strikes/show.html.haml index de883bd873..1c16e0bbf5 100644 --- a/app/views/disputes/strikes/show.html.haml +++ b/app/views/disputes/strikes/show.html.haml @@ -21,51 +21,7 @@ .report-header .report-header__card - .strike-card - - unless @strike.none_action? - %p= t "user_mailer.warning.explanation.#{@strike.action}", instance: Rails.configuration.x.local_domain - - - if @strike.text.present? - = linkify(@strike.text) - - - if @strike.report && !@strike.report.other? - %p - %strong= t('user_mailer.warning.reason') - = t("user_mailer.warning.categories.#{@strike.report.category}") - - - if @strike.report.violation? && @strike.report.rule_ids.present? - %ul.strike-card__rules - - @strike.report.rules.each do |rule| - %li - %span.strike-card__rules__text= rule.text - - - if @strike.status_ids.present? && !@strike.status_ids.empty? - %p - %strong= t('user_mailer.warning.statuses') - - .strike-card__statuses-list - - status_map = @strike.statuses.includes(:application, :media_attachments).index_by(&:id) - - - @strike.status_ids.each do |status_id| - .strike-card__statuses-list__item - - if (status = status_map[status_id.to_i]) - .one-liner - .emojify= one_line_preview(status) - - - status.ordered_media_attachments.each do |media_attachment| - %abbr{ title: media_attachment.description } - = fa_icon 'link' - = media_attachment.file_file_name - .strike-card__statuses-list__item__meta - = link_to ActivityPub::TagManager.instance.url_for(status), target: '_blank', rel: 'noopener noreferrer' do - %time.formatted{ datetime: status.created_at.iso8601, title: l(status.created_at) }= l(status.created_at) - - unless status.application.nil? - · - = status.application.name - - else - .one-liner= t('disputes.strikes.status', id: status_id) - .strike-card__statuses-list__item__meta - = t('disputes.strikes.status_removed') + = render 'card', strike: @strike .report-header__details .report-header__details__item