Helper method for deletion req due at

This commit is contained in:
Matt Jankowski 2024-10-02 08:24:12 -04:00
parent 29df8edbcd
commit 690da4c1e7
2 changed files with 23 additions and 3 deletions

View File

@ -11,8 +11,28 @@ module Admin::AccountsHelper
]
end
def remote_suspension_hint(deletion_request)
if deletion_request.present?
t('admin.accounts.remote_suspension_reversible_hint_html', date: due_date_for_hint(deletion_request))
else
t('admin.accounts.remote_suspension_irreversible')
end
end
def suspension_hint(deletion_request)
if deletion_request.present?
t('admin.accounts.suspension_reversible_hint_html', date: due_date_for_hint(deletion_request))
else
t('admin.accounts.suspension_irreversible')
end
end
private
def due_date_for_hint(deletion_request)
tag.strong(l(deletion_request.due_at.to_date))
end
def pending_user_count_label
number_with_delimiter User.pending.count
end

View File

@ -3,9 +3,9 @@
%p.muted-hint
- if account.suspension_origin_remote?
= deletion_request.present? ? t('admin.accounts.remote_suspension_reversible_hint_html', date: content_tag(:strong, l(deletion_request.due_at.to_date))) : t('admin.accounts.remote_suspension_irreversible')
= remote_suspension_hint(deletion_request)
- else
= deletion_request.present? ? t('admin.accounts.suspension_reversible_hint_html', date: content_tag(:strong, l(deletion_request.due_at.to_date))) : t('admin.accounts.suspension_irreversible')
= suspension_hint(deletion_request)
- if can?(:unsuspend, account)
= button_to t('admin.accounts.undo_suspension'),
@ -20,6 +20,6 @@
- if deletion_request.present? && can?(:destroy, account)
= link_to t('admin.accounts.delete'),
admin_account_path(account.id),
class: 'button button--destructive',
class: [:button, 'button--destructive'],
data: { confirm: t('admin.accounts.are_you_sure') },
method: :delete