Class: SimpleForm::Inputs::DateTimeInput

Inherits:
Base
  • Object
show all
Defined in:
lib/sunrise/views/inputs/date_time_input.rb

Instance Method Summary collapse

Instance Method Details

#inputObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sunrise/views/inputs/date_time_input.rb', line 4

def input
  input_html_options[:value] ||= formated_value
  
  html = [@builder.text_field(attribute_name, input_html_options)]
  
  html << case input_type
    when :date then
      @builder.javascript_tag("$(function() {
      $('##{@builder.object_name}_#{attribute_name}').datepicker({
       numberOfMonths: 2,
       showButtonPanel: true
      });
     });")
   when :datetime then
     @builder.javascript_tag("$(function() {
      $('##{@builder.object_name}_#{attribute_name}').datetimepicker({
       numberOfMonths: 2,
       hourGrid: 4,
          minuteGrid: 10
      });
     });")
 end

 html.join.html_safe
end