Sha256: e74f45bd493cb34c4d074bdfa2ec3923130c7a63936d243151864453e6134695

Contents?: true

Size: 1.26 KB

Versions: 51

Compression:

Stored size: 1.26 KB

Contents

class StandardFormBuilder < AbstractFormBuilder

  # text_field_block(:username, { :class => 'long' }, { :class => 'wide-label' })
  # text_area_block(:summary, { :class => 'long' }, { :class => 'wide-label' })
  # password_field_block(:password, { :class => 'long' }, { :class => 'wide-label' })
  # file_field_block(:photo, { :class => 'long' }, { :class => 'wide-label' })
  # check_box_block(:remember_me, { :class => 'long' }, { :class => 'wide-label' })
  # select_block(:color, :options => ['green', 'black'])
  (self.field_types - [ :hidden_field, :radio_button ]).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]
      field_html = label(field, label_options)
      field_html << #{field_type}(field, options)
      @template.content_tag(:p, field_html)
    end
    EOF
  end

  # submit_block("Update")
  def submit_block(caption, options={})
    submit_html = self.submit(caption, options)
    @template.content_tag(:p, submit_html)
  end

  # image_submit_block("submit.png")
  def image_submit_block(source, options={})
    submit_html = self.image_submit(source, options)
    @template.content_tag(:p, submit_html)
  end
end

Version data entries

51 entries across 51 versions & 2 rubygems

Version Path
sinatra_more-0.3.43 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.42 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.41 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.40 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.39 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.38 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.37 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.36 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.35 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.34 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
darkhelmet-sinatra_more-0.3.36 lib/sinatra/markup_plugin/form_builder/standard_form_builder.rb
darkhelmet-sinatra_more-0.3.35 lib/sinatra/markup_plugin/form_builder/standard_form_builder.rb
darkhelmet-sinatra_more-0.3.34 lib/sinatra/markup_plugin/form_builder/standard_form_builder.rb
darkhelmet-sinatra_more-0.3.33 lib/sinatra/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.33 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.32 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.31 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.30 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.29 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
sinatra_more-0.3.28 lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb