Add confirmation
This commit is contained in:
parent
9e28dae0a8
commit
ec1ac0aa76
4 changed files with 15 additions and 0 deletions
|
@ -1,6 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ContactsHelper
|
||||
def contact_public_switch_confirmation(contact)
|
||||
return if contact.show_in_public?
|
||||
|
||||
translate :contact_public_switch_confirmation, value: contact.value
|
||||
end
|
||||
|
||||
def contact_destroy_confirmation(contact)
|
||||
value = "#{Contact.model_name.human(count: 1)} \"#{contact.value}\""
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<% contacts.each do |contact| %>
|
||||
<tr>
|
||||
<td><%= contact.contact_network.name %></td>
|
||||
|
||||
<td>
|
||||
<% if contact.link.nil? %>
|
||||
<%= truncate contact.value %>
|
||||
|
@ -29,6 +30,7 @@
|
|||
<i class="fas fa-external-link-alt fa-xs text-muted"></i>
|
||||
<% end %>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<% if policy([
|
||||
:settings,
|
||||
|
@ -42,6 +44,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<% if policy([
|
||||
:settings,
|
||||
|
@ -50,11 +53,13 @@
|
|||
<%= 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(
|
||||
|
|
|
@ -15,3 +15,5 @@ en:
|
|||
new_sign_in: New sign in to your account
|
||||
sidekiq: Sidekiq
|
||||
since: since
|
||||
contact_public_switch_confirmation: >
|
||||
Do you really want to make contact "%{value}" public?
|
||||
|
|
|
@ -15,3 +15,5 @@ ru:
|
|||
new_sign_in: Произведён вход в ваш аккаунт
|
||||
sidekiq: Sidekiq
|
||||
since: с
|
||||
contact_public_switch_confirmation: >
|
||||
Вы действительно хотите сделать контакт "%{value}" публичным?
|
||||
|
|
Reference in a new issue