Sha256: f7dc03589a5d3cbe13d1aec63a552112b01362de6ad5419727ecf05df23ebdaf

Contents?: true

Size: 1.04 KB

Versions: 21

Compression:

Stored size: 1.04 KB

Contents

format :html do
  def button_tag content_or_options = nil, options = {}, &block
    bootstrapify_button( block_given? ? content_or_options : options )
    super(content_or_options, options, &block)
  end

  def bootstrapify_button options
    situation = options.delete(:situation) || 'default'
    options[:class] = [ options[:class], 'btn', "btn-#{situation}" ].compact*' '
  end

  def type_field args={}
    args[:class] ||= ''
    args[:class] += ' form-control'
    super(args)
  end

  def bootstrap_options options
    options[:class] ||= ''
    options[:class] += ' form-control'
    options
  end

  FIELD_HELPERS = %w{hidden_field color_field date_field datetime_field datetime_local_field
    email_field month_field number_field password_field phone_field
    range_field search_field telephone_field text_area text_field time_field
    url_field week_field file_field}


  FIELD_HELPERS.each do |method_name|
    define_method(method_name) do |name, options = {}|
      form.send(method_name, name, bootstrap_options(options) )
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
card-1.17.4 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.17.3 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.17.2 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.17.1 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.17.0 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.15 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.14 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.13 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.12 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.11 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.10 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.9 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.8 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.7 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.6 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.5 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.4 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.3 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.2 mod/06_bootstrap/set/all/bootstrap/form.rb
card-1.16.1 mod/06_bootstrap/set/all/bootstrap/form.rb