lib/jqr-helpers/helpers.rb in jqr-helpers-1.0.29 vs lib/jqr-helpers/helpers.rb in jqr-helpers-1.0.30
- old
+ new
@@ -349,10 +349,11 @@
# This is identical to the built-in Rails button_to() in every way except
# that it will work inside an existing form. Instead, it appends a form
# to the body, and uses a click handler to submit it.
# This does not support the :remote option - instead, use {#button_to_ajax}.
+ # This supports the :target option to pass to the form.
# @param content [String] the text of the button.
# @param url [String|Hash] the URL (or URL hash) the button should go to.
# @param options [Hash] HTML Options to pass to the button.
def button_to_external(content, url, options={})
options[:disabled] = 'disabled' if options.delete(:disabled)
@@ -369,9 +370,10 @@
options['data-confirm'] = confirm if confirm
options['data-disable-with'] = disable_with if disable_with
options['data-method'] = method if method
options['data-url'] = url
+ options[:'data-target'] = options.delete(:target)
options[:class] ||= ''
options[:class] << ' ujs-external-button'
if token_name
options['data-token-name'] = token_name
options['data-token-value'] = token_value