class ExtForm::Helpers::Tags::DtPicker

Public Class Methods

field_type() click to toggle source
# File lib/ext_form/helpers/tags/dt_picker.rb, line 29
def self.field_type
  'text'
end

Public Instance Methods

render() click to toggle source
Calls superclass method
# File lib/ext_form/helpers/tags/dt_picker.rb, line 6
def render
  if value_before_type_cast(object).present?
    @options[:value] = value_before_type_cast(object).match(/\d{4}-\d{1,2}-\d{1,2}(\s\d{1,2}:\d{1,2}:\d{1,2})?/)
  end

  output = @template_object.content_tag(:div, nil, class: 'input-append') do
    [super,
     @template_object.content_tag(:span, nil, class: 'add-on') do
       @template_object.content_tag(:i, nil, data: {:'time-icon' => 'icon-time',
                                   :'date-icon' => 'icon-calendar'})
     end
    ].join.html_safe
  end

  html_options = {}
  add_default_name_and_id(html_options)

  output << @template_object.javascript_tag do
    "$(function(){$('##{html_options['id']}').trigger('dt_picker_load');});".html_safe
  end
  output.html_safe
end