forked from fixin.me/fixin.me
Add action confirmation dialog
This commit is contained in:
parent
e4f595a329
commit
f76344c220
@ -87,6 +87,9 @@ module ApplicationHelper
|
||||
|
||||
name = svg_tag("pictograms/#{image}") + name if image
|
||||
html_options[:class] = class_names(html_options[:class], "button", active: current == :active)
|
||||
if html_options[:confirm]
|
||||
html_options[:onclick] = "return confirm('#{html_options.delete(:confirm)}');"
|
||||
end
|
||||
|
||||
send "#{type}_to", name, options, html_options
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
<div class="right">
|
||||
<%# TODO: make confirm dialog work %>
|
||||
<%= image_button_to t(".delete"), "account-remove-outline", user_registration_path,
|
||||
class: "dangerous", method: :delete, data: {confirm: t(".confirm_delete")} %>
|
||||
class: "dangerous", method: :delete, confirm: t(".confirm_delete") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
@ -143,9 +143,7 @@ class UsersTest < ApplicationSystemTestCase
|
||||
first(:link_or_button, user.email).click
|
||||
end
|
||||
assert_difference ->{ User.count }, -1 do
|
||||
# TODO: accept_confirm when modal dialog is working
|
||||
#accept_confirm { click_on t("users.registrations.edit.delete") }
|
||||
click_on t("users.registrations.edit.delete")
|
||||
accept_confirm { click_on t("users.registrations.edit.delete") }
|
||||
end
|
||||
assert_current_path new_user_session_path
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user