Class: Wee::Brush::FormTag

Inherits:
GenericTagBrush show all
Includes:
CallbackMixin
Defined in:
lib/wee/html_brushes.rb

Overview


Form


Constant Summary collapse

HTML_TAG =
'form'.freeze
HTML_METHOD_POST =
'POST'.freeze

Constants inherited from GenericTagBrush

GenericTagBrush::EVENTS

Instance Attribute Summary

Attributes inherited from Wee::Brush

#canvas, #document

Instance Method Summary collapse

Methods included from CallbackMixin

#call, #callback, #callback_method

Methods inherited from GenericTagBrush

#callback_on, #get_oid, html_attr, #javascript_on, #oid, #onclick_callback, #onclick_javascript, #ondblclick_callback, #update_component_on, #update_on

Methods inherited from Wee::Brush

#close, nesting?, #setup

Constructor Details

#initializeFormTag

Returns a new instance of FormTag.



375
376
377
378
# File 'lib/wee/html_brushes.rb', line 375

def initialize
  super(HTML_TAG)
  @attributes[:method] = HTML_METHOD_POST
end

Instance Method Details

#__callbackObject



390
# File 'lib/wee/html_brushes.rb', line 390

def __callback; action(@canvas.url_for_callback(@callback)) end

#enctype_multipartObject

Use this enctype when you have a FileUploadTag field.



371
372
373
# File 'lib/wee/html_brushes.rb', line 371

def enctype_multipart
  enctype('multipart/form-data')
end

#with(&block) ⇒ Object



380
381
382
383
384
385
386
# File 'lib/wee/html_brushes.rb', line 380

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