module FormtasticRebootstrap::Inputs::Base::Timeish
Constants
- FRAGMENT_CLASSES
- FRAGMENT_PLACEHOLDERS
Public Instance Methods
fragment_class(fragment)
click to toggle source
# File lib/formtastic_rebootstrap/inputs/base/timeish.rb, line 60 def fragment_class(fragment) (options[:fragment_classes] || self.class::FRAGMENT_CLASSES)[fragment.to_sym] end
fragment_html(fragment)
click to toggle source
# File lib/formtastic_rebootstrap/inputs/base/timeish.rb, line 41 def fragment_html(fragment) template.content_tag(:div, :class => fragment_class(fragment)) do opts = input_options.merge(:prefix => fragment_prefix, :field_name => fragment_name(fragment), :default => value, :include_blank => include_blank?) template.send(:"select_#{fragment}", value, opts, fragment_input_html_options(fragment)) end end
fragment_input_html_options(fragment)
click to toggle source
# File lib/formtastic_rebootstrap/inputs/base/timeish.rb, line 48 def fragment_input_html_options(fragment) input_html_options.tap do |options| options[:id] = fragment_id(fragment) options[:class] = ((options[:class] || "").split.flatten.reject do |c| c.match(Helpers.bootstrap_layout_classes_regex) end << "form-control").join(" ") options[:placeholder] = fragment_placeholder(fragment) end end
fragment_placeholder(fragment)
click to toggle source
# File lib/formtastic_rebootstrap/inputs/base/timeish.rb, line 64 def fragment_placeholder(fragment) (options[:fragment_placeholders] || self.class::FRAGMENT_PLACEHOLDERS)[fragment.to_sym] end
row_wrapping(&block)
click to toggle source
# File lib/formtastic_rebootstrap/inputs/base/timeish.rb, line 34 def row_wrapping(&block) template.content_tag(:div, template.capture(&block).html_safe, :class => 'form-row md-pl-3' ) end
to_html()
click to toggle source
# File lib/formtastic_rebootstrap/inputs/base/timeish.rb, line 23 def to_html bootstrap_wrapping do hidden_fragments << row_wrapping do fragments.map do |fragment| fragment_html(fragment.to_sym) end.join('<label class="col-form-label">:</label>').html_safe end end end