<table class="table mt-3">
<thead>
<tr>
<th scope="col">
<%= Contact.human_attribute_name :contact_network %>
</th>
<%= Contact.human_attribute_name :value %>
<%= Contact.human_attribute_name :send_security_notifications %>
<%= Contact.human_attribute_name :show_in_public %>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<% contacts.each do |contact| %>
<td><%= contact.contact_network.name %></td>
<td>
<% if contact.link.nil? %>
<%= truncate contact.value %>
<% else %>
<%= link_to truncate(contact.value), contact.link, target: :_blank %>
<i class="fas fa-external-link-alt fa-xs text-muted"></i>
<% end %>
</td>
<% if policy([
:settings,
ContactSecurityNotificationSwitch.new(contact),
]).create? %>
<%= link_to(
settings_contact_security_notification_switch_path(contact),
method: :post,
) do %>
<%= bool_badge contact.send_security_notifications %>
ContactPublicSwitch.new(contact),
settings_contact_public_switch_path(contact),
<%= bool_badge contact.show_in_public %>
<% if policy([:settings, contact]).destroy? %>
[:settings, contact],
method: :delete,
class: 'btn btn-danger btn-sm',
data: { confirm: contact_destroy_confirmation(contact) },
<i class="fas fa-trash"></i>
</tbody>
</table>