From e398327fb704253dbed724436f447e909307f707 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Thu, 24 Oct 2024 20:18:51 +0300 Subject: [PATCH] refactor --- app/views/users/_bottom_links.html.erb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/views/users/_bottom_links.html.erb b/app/views/users/_bottom_links.html.erb index e028bb36..8fbc73e1 100644 --- a/app/views/users/_bottom_links.html.erb +++ b/app/views/users/_bottom_links.html.erb @@ -2,13 +2,15 @@ <% if %w[archived integration].include?(params[:status]) %> <%= link_to t('view_active'), settings_users_path, class: 'link text-sm' %> <% else %> - <% links = [] %> + <% archived_exists = current_account.users.archived.where.not(role: 'integration').exists? %> <% if current_account.users.active.exists?(role: 'integration') %> - <% links << link_to(t('view_embedding_users'), settings_integration_users_path, class: 'link text-sm') %> + <%= link_to t('view_embedding_users'), settings_integration_users_path, class: 'link text-sm' %> + <% if archived_exists %> + | + <% end %> <% end %> - <% if current_account.users.archived.exists? %> - <% links << link_to(t('view_archived'), settings_archived_users_path, class: 'link text-sm') %> + <% if archived_exists %> + <%= link_to t('view_archived'), settings_archived_users_path, class: 'link text-sm' %> <% end %> - <%= links.join('|').html_safe %> <% end %>