From 17705f66ad2f0c1a66469393f009e2081ebd50c6 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 28 Feb 2024 16:42:18 -0300 Subject: [PATCH] feat: tarjeta cacheada de instancia --- app/views/moderation_queue/_instance.haml | 16 +++++++++------- app/views/moderation_queue/_instances.haml | 5 +++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/views/moderation_queue/_instance.haml b/app/views/moderation_queue/_instance.haml index ec76c6e6..73655e1b 100644 --- a/app/views/moderation_queue/_instance.haml +++ b/app/views/moderation_queue/_instance.haml @@ -1,15 +1,17 @@ +- usuaries = instance.content.dig('usage', 'users', 'active_month') +- usuaries ||= instance.content.dig('stats', 'user_count') + .row.no-gutters.pt-2 .col-1 = render 'components/checkbox', id: instance.hostname, name: 'instance_moderation[]', value: instance_moderation.id, data: { target: 'select-all.input' } .col-11 %h4 - %a{ href: instance.uri }= instance.content['title'] - %p= instance.content['description'].html_safe - %dl - %dt.d-inline= t('.users') - %dd.d-inline - = instance.content.dig('usage', 'users', 'active_month') - = instance.content.dig('stats', 'user_count') + %a{ href: instance.uri }= sanitize(instance.content['title']) || instance.hostname + %p= sanitize instance.content['description'] + - if usuaries.present? + %dl + %dt.d-inline= t('.users') + %dd.d-inline= sanitize usuaries.to_s -# Botones moderaciĆ³n .d-flex.pb-4 diff --git a/app/views/moderation_queue/_instances.haml b/app/views/moderation_queue/_instances.haml index 65f4350a..a45da354 100644 --- a/app/views/moderation_queue/_instances.haml +++ b/app/views/moderation_queue/_instances.haml @@ -12,8 +12,9 @@ %h3= t('moderation_queue.nothing') - instance_moderations.each do |instance_moderation| - %hr - = render 'moderation_queue/instance', instance_moderation: instance_moderation, instance: instance_moderation.instance + - cache [instance_moderation.aasm_state, instance_moderation.instance] do + %hr + = render 'moderation_queue/instance', instance_moderation: instance_moderation, instance: instance_moderation.instance %hr %div