Sha256: 5dea389ff3a96040b8255ed88461c671c20957c83265508d45844a741af648d8

Contents?: true

Size: 554 Bytes

Versions: 1

Compression:

Stored size: 554 Bytes

Contents

class StandardFormBuilder < AbstractFormBuilder
  self.field_types.each do |field_type|
    class_eval <<-EOF
    def #{field_type}_block(field, options={}, label_options={})
      label_options.reverse_merge!(:caption => options.delete(:caption)) if options[:caption]
      @template.content_block_tag(:p) do
        html =  label(field, label_options)
        html << #{field_type}(field, options)
      end
    end
    EOF
  end

  def submit_block(caption)
    @template.content_block_tag(:p) do
      @template.submit_tag(caption)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sinatra_more-0.0.7 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb