Module: SweetAlertConfirm::ViewHelpers

Defined in:
lib/sweet-alert-confirm/view_helpers.rb

Instance Method Summary collapse

Instance Method Details



3
4
5
6
7
8
9
10
11
# File 'lib/sweet-alert-confirm/view_helpers.rb', line 3

def link_to(*args, &block)
  html_options = args[block_given? ? 1 : 2] || {}

  if options_has_confirm?(html_options)
    html_options['data-sweet-alert-confirm'] = html_options.delete(:confirm) ||
                html_options[:data].delete(:confirm)
  end
  super *args, &block
end

#submit_tag(value = "Save changes", options = {}) ⇒ Object



13
14
15
16
# File 'lib/sweet-alert-confirm/view_helpers.rb', line 13

def submit_tag(value = "Save changes", options = {})
  options['data-sweet-alert-confirm'] = options.delete(:confirm) || options[:data].delete(:confirm) if options_has_confirm?(options)
  super value, options
end