Class: ActionView::Helpers::JavaScriptElementProxy
- Inherits:
-
JavaScriptProxy
- Object
- ActiveSupport::BasicObject
- JavaScriptProxy
- ActionView::Helpers::JavaScriptElementProxy
- Defined in:
- actionpack/lib/action_view/helpers/prototype_helper.rb
Overview
:nodoc:
Instance Method Summary (collapse)
-
- (Object) [](attribute)
Allows access of element attributes through attribute.
- - (Object) []=(variable, value)
-
- (JavaScriptElementProxy) initialize(generator, id)
constructor
A new instance of JavaScriptElementProxy.
- - (Object) reload(options_for_replace = {})
- - (Object) replace(*options_for_render)
- - (Object) replace_html(*options_for_render)
Methods inherited from JavaScriptProxy
Methods inherited from ActiveSupport::BasicObject
Constructor Details
- (JavaScriptElementProxy) initialize(generator, id)
A new instance of JavaScriptElementProxy
689 690 691 692 |
# File 'actionpack/lib/action_view/helpers/prototype_helper.rb', line 689 def initialize(generator, id) @id = id super(generator, "$(#{::ActiveSupport::JSON.encode(id)})") end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActionView::Helpers::JavaScriptProxy
Instance Method Details
- (Object) [](attribute)
Allows access of element attributes through attribute. Examples:
page['foo']['style'] # => $('foo').style;
page['foo']['style']['color'] # => $('blank_slate').style.color;
page['foo']['style']['color'] = 'red' # => $('blank_slate').style.color = 'red';
page['foo']['style'].color = 'red' # => $('blank_slate').style.color = 'red';
700 701 702 703 |
# File 'actionpack/lib/action_view/helpers/prototype_helper.rb', line 700 def [](attribute) append_to_function_chain!(attribute) self end |
- (Object) []=(variable, value)
705 706 707 |
# File 'actionpack/lib/action_view/helpers/prototype_helper.rb', line 705 def []=(variable, value) assign(variable, value) end |
- (Object) reload(options_for_replace = {})
717 718 719 |
# File 'actionpack/lib/action_view/helpers/prototype_helper.rb', line 717 def reload( = {}) replace(.merge({ :partial => @id.to_s })) end |
- (Object) replace(*options_for_render)
713 714 715 |
# File 'actionpack/lib/action_view/helpers/prototype_helper.rb', line 713 def replace(*) call 'replace', @generator.send(:render, *) end |
- (Object) replace_html(*options_for_render)
709 710 711 |
# File 'actionpack/lib/action_view/helpers/prototype_helper.rb', line 709 def replace_html(*) call 'update', @generator.send(:render, *) end |