3
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
29
|
# File 'lib/generators/files_for_generator/date_time_picker_input.rb', line 3
def input
out = ''
date_format = input_html_options[:date_format] ? input_html_options.delete(:date_format) : "dd/MM/yyyy hh:mm:ss"
default_value = input_html_options[:default_value] ? input_html_options.delete(:default_value) : ""
in_modal = input_html_options["data-in-modal"] ? input_html_options.delete("data-in-modal") : nil
close_javascript_support = input_html_options["data-close-js-support"] ? input_html_options.delete("data-close-js-support") : nil
attribute_id = (attribute_name.to_s + "_id")
input_html_options["data-format"] = date_format
out << '<div id="'+attribute_id+'" class="input-append date datetimepicker_gea">'
out << @builder.text_field(attribute_name, input_html_options)
out << "<span class=\"add-on\">"
out << "<i data-time-icon=\"icon-time\" data-date-icon=\"icon-calendar\">"
out << "</i>"
out << "</span>"
out << "</div>"
if in_modal || close_javascript_support
out << '<script type="text/javascript">'
out << "$(function() { $('.datetimepicker_gea').datetimepicker({language: 'en-AU'});});"
out << "</script>"
end
out.html_safe
end
|