Class: ActionView::Helpers::JavaScriptElementProxy
Overview
Instance Method Summary
collapse
#is_a?
Constructor Details
688
689
690
691
|
# File 'lib/action_view/helpers/prototype_helper.rb', line 688
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
#[](attribute) ⇒ Object
Allows access of element attributes through attribute. Examples:
page['foo']['style']
page['foo']['style']['color']
page['foo']['style']['color'] = 'red'
page['foo']['style'].color = 'red'
699
700
701
702
|
# File 'lib/action_view/helpers/prototype_helper.rb', line 699
def [](attribute)
append_to_function_chain!(attribute)
self
end
|
#[]=(variable, value) ⇒ Object
704
705
706
|
# File 'lib/action_view/helpers/prototype_helper.rb', line 704
def []=(variable, value)
assign(variable, value)
end
|
#reload(options_for_replace = {}) ⇒ Object
716
717
718
|
# File 'lib/action_view/helpers/prototype_helper.rb', line 716
def reload(options_for_replace = {})
replace(options_for_replace.merge({ :partial => @id.to_s }))
end
|
#replace(*options_for_render) ⇒ Object
712
713
714
|
# File 'lib/action_view/helpers/prototype_helper.rb', line 712
def replace(*options_for_render)
call 'replace', @generator.send(:render, *options_for_render)
end
|
#replace_html(*options_for_render) ⇒ Object
708
709
710
|
# File 'lib/action_view/helpers/prototype_helper.rb', line 708
def replace_html(*options_for_render)
call 'update', @generator.send(:render, *options_for_render)
end
|