private Method

UrlHelper.convert_options_to_javascript!(html_options, url = '')

There's no documentation for this item.

Source Code

# File action_view/helpers/url_helper.rb, line 442
def convert_options_to_javascript!(html_options, url = '')
  confirm, popup = html_options.delete("confirm"), html_options.delete("popup")

  method, href = html_options.delete("method"), html_options['href']

  html_options["onclick"] = case
    when popup && method
      raise ActionView::ActionViewError, "You can't use :popup and :method in the same link"
    when confirm && popup
      "if (#{confirm_javascript_function(confirm)}) { #{popup_javascript_function(popup)} };return false;"
    when confirm && method
      "if (#{confirm_javascript_function(confirm)}) { #{method_javascript_function(method)} };return false;"
    when confirm
      "return #{confirm_javascript_function(confirm)};"
    when method
      "#{method_javascript_function(method, url, href)}return false;"
    when popup
      popup_javascript_function(popup) + 'return false;'
    else
      html_options["onclick"]
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.