Disallow using onclick: action with confirm:

This commit is contained in:
2023-05-14 18:20:26 +02:00
parent f76344c220
commit 35037648bd
2 changed files with 3 additions and 4 deletions

View File

@@ -87,8 +87,8 @@ 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)}');"
if html_options[:onclick]&.is_a? Hash
html_options[:onclick] = "return confirm('#{html_options[:onclick][:confirm]}');"
end
send "#{type}_to", name, options, html_options