Module: Formz::Descriptions

Defined in:
lib/formz/descriptions.rb

Overview

Formz::Descriptions

The Formz:Descriptions module allows a :description attribute to be passed, which then appends a tag containing the field description.

Examples

tag :input, :type => :file, :name => :upload, :description => 'Upload a file.'

<div class="form-upload form-file">
  <input type="file" name="upload" />
  <span class="description">Upload a file.</span>
</div>

Instance Method Summary collapse

Instance Method Details

#create_tag(name, contents, attrs, &block) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/formz/descriptions.rb', line 22

def create_tag name, contents, attrs, &block
  if description = attrs.delete(:description)
    super << Tagz.tag(:span, description, :class => 'description')
  else
    super
  end
end