10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/date_picker/styles/jquery_ui.rb', line 10
def template()
%{
<%= input_html %>
<input id="<%= input_id %>_hidden" type="hidden" value="<%= value %>" name="<%= name %>"/>
<script>
(function() {
$('#<%= input_id %>').datepicker($.extend({
monthNames: <%= month_names.to_json %>,
monthNamesShort: <%= abbr_month_names.to_json %>,
dayNames: <%= day_names.to_json %>,
dayNamesMin: <%= abbr_day_names.to_json %>,
dayNamesShort: <%= abbr_day_names.to_json %>
}, <%= json_options %>, {
locale: <%= locale.to_json %>,
dateFormat: <%= format.to_json %>
})).on('change', function(e) {
console.log("change: ", $('#<%= input_id %>').val());
$('#<%= input_id %>_hidden').val($.datepicker.formatDate('<%= data_format %>', $('#<%= input_id %>').datepicker('getDate')));
});
<% if time %> $('#<%= input_id %>').datepicker('setDate', new Date(<%= time %>)); <% end %>
})();
</script>
}
end
|