Class: ActionView::Helpers::JavaScriptElementProxy

Inherits:
JavaScriptProxy
  • Object
show all
Defined in:
lib/action_view/helpers/javascript_proxies.rb

Overview

:nodoc:

Constant Summary collapse

JQUERY_VAR =
::JRails::JQUERY_VAR

Instance Method Summary collapse

Methods inherited from JavaScriptProxy

#is_a?

Constructor Details

#initialize(generator, id) ⇒ JavaScriptElementProxy

Returns a new instance of JavaScriptElementProxy.



147
148
149
150
151
# File 'lib/action_view/helpers/javascript_proxies.rb', line 147

def initialize(generator, id)
  id = id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id
  @id = id
  super(generator, "#{JQUERY_VAR}(\"#{id}\")")
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActionView::Helpers::JavaScriptProxy

Instance Method Details

#reload(options_for_replace = {}) ⇒ Object



161
162
163
# File 'lib/action_view/helpers/javascript_proxies.rb', line 161

def reload(options_for_replace={})
  replace(options_for_replace.merge({ :partial => @id.to_s.sub(/^#/,'') }))
end

#replace(*options_for_render) ⇒ Object



157
158
159
# File 'lib/action_view/helpers/javascript_proxies.rb', line 157

def replace(*options_for_render)
  call 'replaceWith', @generator.send(:render, *options_for_render)
end

#replace_html(*options_for_render) ⇒ Object



153
154
155
# File 'lib/action_view/helpers/javascript_proxies.rb', line 153

def replace_html(*options_for_render)
  call 'html', @generator.send(:render, *options_for_render)
end

#valueObject



165
166
167
# File 'lib/action_view/helpers/javascript_proxies.rb', line 165

def value()
  call 'val()'
end

#value=(value) ⇒ Object



169
170
171
# File 'lib/action_view/helpers/javascript_proxies.rb', line 169

def value=(value)
  call 'val', value
end