Class: Wee::Brush::FormTag

Inherits:
GenericTagBrush show all
Defined in:
lib/wee/renderer/html/brushes.rb

Direct Known Subclasses

Nitro::FormTag, Rails::FormTag

Instance Attribute Summary

Attributes inherited from Wee::Brush

#canvas, #parent

Instance Method Summary collapse

Methods inherited from GenericTagBrush

#__action_callback, #__actionurl_callback, #__actionurl_named_callback, #__input_callback, #css_class, #css_class_for, #method_missing, #onclick_callback, #onclick_update

Methods inherited from Wee::Brush

#close

Constructor Details

#initializeFormTag

Returns a new instance of FormTag.



544
545
546
547
# File 'lib/wee/renderer/html/brushes.rb', line 544

def initialize
  super('form')
  @attributes['method'] = 'POST'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Wee::Brush::GenericTagBrush

Instance Method Details

#onsubmit_update(update_id, symbol = nil, *args, &block) ⇒ Object

Raises:

  • (ArgumentError)


555
556
557
558
559
# File 'lib/wee/renderer/html/brushes.rb', line 555

def onsubmit_update(update_id, symbol=nil, *args, &block)
  raise ArgumentError if symbol and block
  url = @canvas.url_for_callback(to_callback(symbol, args, block), :live_update)
  onsubmit("javascript: new Ajax.Updater('#{ update_id }', '#{ url }', {method:'get', parameters: Form.serialize(this)}); return false;")
end

#with(*args, &block) ⇒ Object



561
562
563
564
565
566
567
# File 'lib/wee/renderer/html/brushes.rb', line 561

def with(*args, &block)
  # If no action was specified, use a dummy one.
  unless @attributes.has_key?('action')
    @attributes['action'] = @canvas.build_url
  end
  super
end