Class: ActionView::Helpers::JavaScriptElementProxy
- Inherits:
-
JavaScriptProxy
- Object
- Builder::BlankSlate
- JavaScriptProxy
- ActionView::Helpers::JavaScriptElementProxy
- Defined in:
- lib/action_view/helpers/prototype_helper.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#[](attribute) ⇒ Object
Allows access of element attributes through
attribute
. - #[]=(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.
727 728 729 730 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 727 def initialize(generator, id) @id = id super(generator, "$(#{id.to_json})") end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActionView::Helpers::JavaScriptProxy
Instance Method Details
#[](attribute) ⇒ Object
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';
738 739 740 741 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 738 def [](attribute) append_to_function_chain!(attribute) self end |
#[]=(variable, value) ⇒ Object
743 744 745 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 743 def []=(variable, value) assign(variable, value) end |
#reload(options_for_replace = {}) ⇒ Object
755 756 757 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 755 def reload( = {}) replace(.merge({ :partial => @id.to_s })) end |
#replace(*options_for_render) ⇒ Object
751 752 753 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 751 def replace(*) call 'replace', @generator.send(:render, *) end |
#replace_html(*options_for_render) ⇒ Object
747 748 749 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 747 def replace_html(*) call 'update', @generator.send(:render, *) end |