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

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

#get_oid, html_attr, #oid, #onclick_callback, #onclick_javascript, #onclick_update_callback, #onclick_update_self_callback, #ondblclick_callback

Methods inherited from Wee::Brush

#close, nesting?, #setup

Constructor Details

#initializeFormTag

Returns a new instance of FormTag.



328
329
330
331
# File 'lib/wee/html_brushes.rb', line 328

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

Instance Method Details

#__callbackObject



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

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

#enctype_multipartObject

Use this enctype when you have a FileUploadTag field.



324
325
326
# File 'lib/wee/html_brushes.rb', line 324

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

#with(&block) ⇒ Object



333
334
335
336
337
338
339
# File 'lib/wee/html_brushes.rb', line 333

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