Class: DatePicker::Styles::Pickadate

Inherits:
Object
  • Object
show all
Defined in:
lib/date_picker/styles/pickadate.rb

Instance Method Summary collapse

Instance Method Details

#mappingObject



7
8
9
# File 'lib/date_picker/styles/pickadate.rb', line 7

def mapping()
  :pickadate
end

#templateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/date_picker/styles/pickadate.rb', line 10

def template() 
  %{
    <%= input_html %>
    <script>
      (function($) {
        var
          type = '<%= type %>',
          plugin = 'picka' + type,
          options = $.extend(true, {}, <%= picker_options %>, {
            monthsFull: <%= month_names.to_json %>,
            monthsShort: <%= abbr_month_names.to_json %>,
            weekdaysFull: <%= day_names.to_json %>,
            weekdaysShort: <%= abbr_day_names.to_json %>,
            format: '<%= picker_format %>',
            formatSubmit: '<%= data_format %>',
            hiddenName: true,
            min: <%= min ? 'new Date("' + min.to_s + '")' : 'undefined' %>,
            max: <%= max ? 'new Date("' + max.to_s + '")' : 'undefined' %>
          }),
          $element = $('#<%= input_id %>'),
          picker = $element[plugin] && $element[plugin](options)[plugin]('picker');
      })(jQuery);
    </script>
  }
end

#typesObject



4
5
6
# File 'lib/date_picker/styles/pickadate.rb', line 4

def types
  [:date, :time]
end