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