Module: FormtasticBootstrap::Inputs::Base::Timeish
- Included in:
- DateSelectInput, DatetimeSelectInput, TimeSelectInput
- Defined in:
- lib/formtastic-bootstrap/inputs/base/timeish.rb
Instance Method Summary collapse
- #controls_wrapper_html_options ⇒ Object
- #fragment_class(fragment) ⇒ Object
- #fragment_input_html(fragment) ⇒ Object
- #fragment_input_html_options(fragment) ⇒ Object
- #fragment_placeholder(fragment) ⇒ Object
- #to_html ⇒ Object
Instance Method Details
#controls_wrapper_html_options ⇒ Object
18 19 20 21 22 |
# File 'lib/formtastic-bootstrap/inputs/base/timeish.rb', line 18 def super.tap do || [:class] = ([:class].split << "controls-row").join(" ") end end |
#fragment_class(fragment) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/formtastic-bootstrap/inputs/base/timeish.rb', line 37 def fragment_class(fragment) { :year => "span1", :month => "span2", :day => "span1", :hour => "span1", :minute => "span1", :second => "span1" }[fragment] end |
#fragment_input_html(fragment) ⇒ Object
24 25 26 27 |
# File 'lib/formtastic-bootstrap/inputs/base/timeish.rb', line 24 def fragment_input_html(fragment) opts = .merge(:prefix => fragment_prefix, :field_name => fragment_name(fragment), :default => value, :include_blank => include_blank?) template.send(:"select_#{fragment}", value, opts, (fragment)) end |
#fragment_input_html_options(fragment) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/formtastic-bootstrap/inputs/base/timeish.rb', line 29 def (fragment) .tap do || [:id] = fragment_id(fragment) [:class] = (([:class] || "").split << fragment_class(fragment)).join(" ") [:placeholder] = fragment_placeholder(fragment) end end |
#fragment_placeholder(fragment) ⇒ Object
48 49 50 |
# File 'lib/formtastic-bootstrap/inputs/base/timeish.rb', line 48 def fragment_placeholder(fragment) "." + fragment_class(fragment) end |
#to_html ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/formtastic-bootstrap/inputs/base/timeish.rb', line 6 def to_html control_group_wrapping do control_label_html << controls_wrapping do hidden_fragments << fragments.map do |fragment| fragment_input_html(fragment) end.join.html_safe end end end |