Module: RailsAjax::UrlHelper
- Included in:
- ActionView::Base
- Defined in:
- lib/rails-ajax/url_helper.rb
Overview
Module defining methods to include in ActionView::Helpers::FormHelper
Instance Method Summary collapse
-
#link_to(*args, &block) ⇒ Object
Adapt link_to method to handle Ajax queries automatically.
Instance Method Details
#link_to(*args, &block) ⇒ Object
Adapt link_to method to handle Ajax queries automatically
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rails-ajax/url_helper.rb', line 12 def link_to(*args, &block) if (RailsAjax.config.Enabled) lName = args.first lOptions = args.second || {} lHTMLOptions = args.third || {} # Decide if we use rails-ajax or not for this link if RailsAjax::rails_ajaxifiable?(lHTMLOptions) # Adapt the link if block_given? return super(lName, lOptions, lHTMLOptions.merge({ :remote => true, :'data-rails-ajax-remote' => true })) do block.call end else return super(lName, lOptions, lHTMLOptions.merge({ :remote => true, :'data-rails-ajax-remote' => true })) end elsif block_given? # Don't use Rails-Ajax return super(*args) do block.call end else return super(*args) end elsif block_given? # Don't use Rails-Ajax return super(*args) do block.call end else return super(*args) end end |