4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/semanticgap_date_time_form/form_builder_mixin.rb', line 4
def datetime_form(attr, value = nil)
value ||= @object.try(datetime_param(attr))
form = fields_for(datetime_param(attr), value) do |f|
f.text_field(:year, :size => 4) + "/" +
@template.select_month(value, :prefix => f.object_name, :include_blank => value.allow_blank?) + "/" +
f.text_field(:day, :size => 2) + "—" +
f.text_field(:hour, :size => 2) + ":" +
f.text_field(:minute, :size => 2) +
f.select(:ampm, %W(AM PM)) +
@template.content_tag('span', value.time_zone.name, :class => 'timezone')
end
@template.content_tag('div', form, :class => 'sg-datetime-form')
end
|