From 40242fafee83cf9a6bcb2d0ac1e228827969402f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 29 Aug 2025 11:19:59 -0400 Subject: [PATCH] Use partial for severed relationship download area (#35945) --- .../severed_relationships/_download.html.haml | 6 +++++ .../severed_relationships/_event.html.haml | 14 ++++++++++++ .../severed_relationships/index.html.haml | 22 +------------------ 3 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 app/views/severed_relationships/_download.html.haml create mode 100644 app/views/severed_relationships/_event.html.haml diff --git a/app/views/severed_relationships/_download.html.haml b/app/views/severed_relationships/_download.html.haml new file mode 100644 index 0000000000..b1eb76c920 --- /dev/null +++ b/app/views/severed_relationships/_download.html.haml @@ -0,0 +1,6 @@ +-# locals(count:, link:) + +- if count.zero? + = t('generic.none') +- else + = table_link_to 'download', t('severed_relationships.download', count:), link diff --git a/app/views/severed_relationships/_event.html.haml b/app/views/severed_relationships/_event.html.haml new file mode 100644 index 0000000000..adc7752cb9 --- /dev/null +++ b/app/views/severed_relationships/_event.html.haml @@ -0,0 +1,14 @@ +-# locals(event:) + +%tr + %td + %time.formatted{ datetime: event.created_at.iso8601, title: l(event.created_at) } + = l(event.created_at) + %td= t("severed_relationships.event_type.#{event.type}", target_name: event.target_name) + - if event.purged? + %td{ rowspan: 2 }= t('severed_relationships.purged') + - else + %td + = render 'download', count: event.following_count, link: following_severed_relationship_path(event, format: :csv) + %td + = render 'download', count: event.followers_count, link: followers_severed_relationship_path(event, format: :csv) diff --git a/app/views/severed_relationships/index.html.haml b/app/views/severed_relationships/index.html.haml index cc9439b468..d4ce658ca3 100644 --- a/app/views/severed_relationships/index.html.haml +++ b/app/views/severed_relationships/index.html.haml @@ -13,24 +13,4 @@ %th= t('severed_relationships.lost_follows') %th= t('severed_relationships.lost_followers') %tbody - - @events.each do |event| - %tr - %td - %time.formatted{ datetime: event.created_at.iso8601, title: l(event.created_at) } - = l(event.created_at) - %td= t("severed_relationships.event_type.#{event.type}", target_name: event.target_name) - - if event.purged? - %td{ rowspan: 2 }= t('severed_relationships.purged') - - else - %td - - count = event.following_count - - if count.zero? - = t('generic.none') - - else - = table_link_to 'download', t('severed_relationships.download', count: count), following_severed_relationship_path(event, format: :csv) - %td - - count = event.followers_count - - if count.zero? - = t('generic.none') - - else - = table_link_to 'download', t('severed_relationships.download', count: count), followers_severed_relationship_path(event, format: :csv) + = render partial: 'event', collection: @events