Class: Inputs::EffectiveDateTimePicker::Input
Instance Method Summary
collapse
#field_name, #initialize, #value
Instance Method Details
10
11
12
|
# File 'app/models/inputs/effective_date_time_picker/input.rb', line 10
def default_input_classes
[:effective_date_time_picker, :datetime]
end
|
6
7
8
|
# File 'app/models/inputs/effective_date_time_picker/input.rb', line 6
def default_input_js_options
{:format => 'YYYY-MM-DD h:mm A', :sideBySide => true}
end
|
#options ⇒ Object
27
28
29
30
31
32
33
|
# File 'app/models/inputs/effective_date_time_picker/input.rb', line 27
def options
super do |options|
unless options['data-input-js-options'][:format].present?
options[:pattern] = '\d{4}-\d{2}-\d{2} \d+:\d{2} [A-Z]{2}'
end
end
end
|
#to_html ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/models/inputs/effective_date_time_picker/input.rb', line 14
def to_html
if options.delete(:input_group) == false
return text_field_tag(field_name, value, options)
end
content_tag(:div, :class => 'input-group') do
content_tag(:span, :class => 'input-group-addon') do
content_tag(:i, '', :class => 'glyphicon glyphicon-calendar').html_safe
end +
text_field_tag(field_name, value, options)
end
end
|