Sha256: d3d2e498b5bfc1f8ac2e7030ebe7f8491b122ff9ba8bd9c7a8022f23f9fbc007

Contents?: true

Size: 680 Bytes

Versions: 3

Compression:

Stored size: 680 Bytes

Contents

class Manifest::LabelledFormBuilder < ActionView::Helpers::FormBuilder
  %w[text_field check_box collection_select check_box text_area date_select datetime_select time_select].each do |method_name|
    define_method(method_name) do |name, *args|
      classes = %w[field]

      if %w[collection_select check_box].include? method_name
        classes << 'inline-label'
      end

      @template.content_tag :div, class: classes.join(' ') do
        label(name) + super(name, *args)
      end
    end
  end

  %w[submit].each do |method_name|
    define_method(method_name) do
      @template.content_tag :div, class: 'form-actions' do
        super()
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
manifest-rails-0.1.2 app/form_builders/manifest/labelled_form_builder.rb
manifest-rails-0.1.1 app/form_builders/manifest/labelled_form_builder.rb
manifest-rails-0.1.0 app/form_builders/manifest/labelled_form_builder.rb