Class: JQueryOnRails::Helpers::JavaScriptElementProxy
- Inherits:
-
JavaScriptProxy
- Object
- ActionView::Helpers::JavaScriptProxy
- JavaScriptProxy
- JQueryOnRails::Helpers::JavaScriptElementProxy
- Defined in:
- lib/jquery_on_rails/helpers/jquery_helper.rb
Overview
Adapted from Rails 3 ActionView::Helpers::JavaScriptProxy
Instance Method Summary collapse
- #[](attribute) ⇒ Object
- #[]=(variable, value) ⇒ Object
-
#initialize(generator, id) ⇒ JavaScriptElementProxy
constructor
A new instance of JavaScriptElementProxy.
- #reload(options_for_replace = {}) ⇒ Object
- #replace(*options_for_render) ⇒ Object
- #replace_html(*options_for_render) ⇒ Object
Constructor Details
#initialize(generator, id) ⇒ JavaScriptElementProxy
Returns a new instance of JavaScriptElementProxy.
356 357 358 359 |
# File 'lib/jquery_on_rails/helpers/jquery_helper.rb', line 356 def initialize(generator, id) @id = id super(generator, "jQuery(#{::ActiveSupport::JSON.encode('#'+id.to_s)})") end |
Instance Method Details
#[](attribute) ⇒ Object
361 362 363 364 365 366 |
# File 'lib/jquery_on_rails/helpers/jquery_helper.rb', line 361 def [](attribute) if Fixnum === attribute then array_access(attribute) else append_to_function_chain!(attribute) end self end |
#[]=(variable, value) ⇒ Object
368 369 370 |
# File 'lib/jquery_on_rails/helpers/jquery_helper.rb', line 368 def []=(variable, value) assign(variable, value) end |
#reload(options_for_replace = {}) ⇒ Object
380 381 382 |
# File 'lib/jquery_on_rails/helpers/jquery_helper.rb', line 380 def reload( = {}) replace(.merge({ :partial => @id.to_s })) end |
#replace(*options_for_render) ⇒ Object
376 377 378 |
# File 'lib/jquery_on_rails/helpers/jquery_helper.rb', line 376 def replace(*) call 'replaceWith', @generator.send(:render, *) end |
#replace_html(*options_for_render) ⇒ Object
372 373 374 |
# File 'lib/jquery_on_rails/helpers/jquery_helper.rb', line 372 def replace_html(*) call 'html', @generator.send(:render, *) end |