method
convert_options_to_javascript!
v1.0.0 -
Show latest stable
- Class:
ActionView::Helpers::UrlHelper
convert_options_to_javascript!(html_options)private
No documentation available.
# File actionpack/lib/action_view/helpers/url_helper.rb, line 242
def convert_options_to_javascript!(html_options)
confirm, popup, post = html_options.delete("confirm"), html_options.delete("popup"), html_options.delete("post")
html_options["onclick"] = case
when popup && post
raise ActionView::ActionViewError, "You can't use :popup and :post in the same link"
when confirm && popup
"if (#{confirm_javascript_function(confirm)}) { #{popup_javascript_function(popup)} };return false;"
when confirm && post
"if (#{confirm_javascript_function(confirm)}) { #{post_javascript_function} };return false;"
when confirm
"return #{confirm_javascript_function(confirm)};"
when post
"#{post_javascript_function}return false;"
when popup
popup_javascript_function(popup) + 'return false;'
else
html_options["onclick"]
end
end