Class: ActionView::Helpers::JavaScriptElementProxy

Inherits:
JavaScriptProxy
  • Object
show all
Defined in:
lib/jrails.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.



234
235
236
237
238
# File 'lib/jrails.rb', line 234

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



248
249
250
# File 'lib/jrails.rb', line 248

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

#replace(*options_for_render) ⇒ Object



244
245
246
# File 'lib/jrails.rb', line 244

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

#replace_html(*options_for_render) ⇒ Object



240
241
242
# File 'lib/jrails.rb', line 240

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

#valueObject



252
253
254
# File 'lib/jrails.rb', line 252

def value()
  call 'val()'
end

#value=(value) ⇒ Object



256
257
258
# File 'lib/jrails.rb', line 256

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