Module: BootstrapDatepickerTag::Helper

Defined in:
lib/app/helper.rb

Constant Summary collapse

DEF_OPTS =
{
  size: 30
}

Instance Method Summary collapse

Instance Method Details

#datepicker_input_tag(name, value = nil, opts = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/app/helper.rb', line 7

def datepicker_input_tag(name, value = nil, opts = {})
  options = DEF_OPTS.merge(opts)
  dp_options, tf_options =  split_options(options)
  html = text_field_tag(name, value, tf_options)
  method = "datepicker"
  html += javascript_tag "jQuery(document).ready(function(){jQuery('##{name}').#{method}(#{dp_options.to_json})});", type: "text/javascript"
  html.html_safe
end