Sha256: 7dad55dc0176eefe0c0a379c40fab582e7bb88893915facf0e9ebfb3ab82a849

Contents?: true

Size: 936 Bytes

Versions: 8

Compression:

Stored size: 936 Bytes

Contents

class StandardFormBuilder < AbstractFormBuilder
  
  # text_field_block(:username, { :class => 'long' }, { :class => 'wide-label' })
  # text_area_block(:username, { :class => 'long' }, { :class => 'wide-label' })
  # password_field_block(:username, { :class => 'long' }, { :class => 'wide-label' })
  # file_field_block(:username, { :class => 'long' }, { :class => 'wide-label' })
  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

  # submit_block("Update")
  def submit_block(caption, options={})
    @template.content_block_tag(:p) do
      @template.submit_tag(caption, options)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sinatra_more-0.1.6 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.1.5 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.1.4 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.1.3 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.1.2 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.1.1 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.1.0 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.0.14 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb