Class: ActionView::Helpers::JavaScriptElementProxy

Inherits:
JavaScriptProxy
  • Object
show all
Defined in:
lib/jquery/jquery.rb

Overview

:nodoc:

Constant Summary collapse

JQUERY_VAR =
PrototypeHelper::JQUERY_VAR

Instance Method Summary collapse

Constructor Details

#initialize(generator, id) ⇒ JavaScriptElementProxy

Returns a new instance of JavaScriptElementProxy.



247
248
249
250
251
# File 'lib/jquery/jquery.rb', line 247

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

Instance Method Details

#reload(options_for_replace = {}) ⇒ Object



261
262
263
# File 'lib/jquery/jquery.rb', line 261

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

#replace(*options_for_render) ⇒ Object



257
258
259
# File 'lib/jquery/jquery.rb', line 257

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

#replace_html(*options_for_render) ⇒ Object



253
254
255
# File 'lib/jquery/jquery.rb', line 253

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

#valueObject



265
266
267
# File 'lib/jquery/jquery.rb', line 265

def value()
  call 'val()'
end

#value=(value) ⇒ Object



269
270
271
# File 'lib/jquery/jquery.rb', line 269

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