Module: Card::Set::All::Bootstrap::Form::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod026-bootstrap/all/bootstrap/form.rb

Constant Summary collapse

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].freeze

Instance Method Summary collapse

Instance Method Details

#bootstrap_options(options) ⇒ Object



25
26
27
28
29
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/form.rb', line 25

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

#bootstrapify_button(options) ⇒ Object



14
15
16
17
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/form.rb', line 14

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

#button_tag(content_or_options = nil, options = {}, &block) ⇒ Object



9
10
11
12
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/form.rb', line 9

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

#type_field(args = {}) ⇒ Object



19
20
21
22
23
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/form.rb', line 19

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