Class: Campo::Textarea

Inherits:
Base
  • Object
show all
Defined in:
lib/campo/campo.rb

Constant Summary collapse

DEFAULT =
{ cols: 40, rows: 10, tabindex: %q!#{@campo_tabindex += 1}! }

Instance Attribute Summary

Attributes inherited from Base

#attributes, #attributes The element's html attributes., #fields, #fields The element's child elements.

Attributes included from Childish

#parent

Instance Method Summary collapse

Methods inherited from Base

#each, #labelled, #on_output, #output, output, quotable, unhash

Methods included from Convenience

#bit_of_ruby, #checkbox, #fieldset, #hidden, #input, #literal, #password, #radio, #select, #submit, #text, #textarea

Methods included from Iding

#id_tag

Methods included from Childish

#push=

Constructor Details

#initialize(name, inner = nil, attributes = {}) ⇒ Textarea

Returns a new instance of Textarea.



722
723
724
725
726
727
728
729
730
731
732
# File 'lib/campo/campo.rb', line 722

def initialize( name,  inner=nil, attributes={} )
  if inner.kind_of? Hash
    attributes = inner
    inner = nil
  end
  super( name, DEFAULT.merge( attributes ) )
  @inner = inner
  self.on_output do |n=0, tab=2|
    %Q!#{" " * n * tab}%textarea{ atts[:#{name.gsub(/\W/, "_")}], #{Base.unhash( @attributes )} }= inners[:#{name.gsub(/\W/, "_")}] !
  end
end