instance method convert_options_to_javascript!

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18 Private

Available in: v2.2.3 v2.3.18

Signature

convert_options_to_javascript!(html_options, url = '')

No documentation comment.

Parameters

html_options req
url opt = ''
Source
# File actionpack/lib/action_view/helpers/url_helper.rb, line 537
        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

Defined in actionpack/lib/action_view/helpers/url_helper.rb line 537 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionView::Helpers::UrlHelper

Type at least 2 characters to search.

↑↓ navigate · open · esc close