mois3x / sweet-alert-rails-confirm

A Rails confirm replacement with SweetAlert
MIT License
73 stars 50 forks source link

Support button_tag? #13

Closed elbarsal closed 9 years ago

elbarsal commented 9 years ago

Wondering if you could add support for button_tag elements. Not sure if this is 100% correct, but the code below worked for me. If you prefer, I can put in a pull request.

def button_tag(*args, &block)

  html_options = args[block_given? ? 0 : 1] || {}

  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
mois3x commented 9 years ago

Hi thanks check it out now with bundle update

mois3x commented 9 years ago

Closing this since it seems working with no problem