1
0
Fork 0
This repository has been archived on 2023-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/views/settings/contacts/_table.html.erb

82 lines
2.3 KiB
Plaintext

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