当用户在我的活动策划应用程序中单击 AddDate 时,我会添加如下所示的一行,以便用户可以添加日期和开始/结束时间以及 AM/PM。
但在我使用嵌套属性的表单中,似乎我的选择控件需要引用他们设置的模型字段(:start_time 和:end_time)。但是开始和结束时间是由两个选择控件创建的,一个用于小时,一个用于分钟。所以我不确定两个选择中选择的值将如何组合形成开始时间和结束时间。
<div class="user_event_inline_container margin_left_ten padding_right_gone">
<%= f.label :start_time, "Start", class: 'info_inline_control info_label five_margin_right' %>
<%= f.select :start_time, options_for_select([['1',1],['2',2],['3',3],['4',4],['5',5],['6',6],['7',7],['8',8],['9',9],['10',10],['11',11],['12',12]]), class: (field_class(@user_event, :start_time) + 'info_inline_control') %>
<%= f.select :start_time, options_for_select([['00',1],['15',2],['30',3],['45',4]]), class: (field_class(@user_event, :start_time) + 'info_inline_control') %>
<%= f.select :start_am_pm, options_for_select([['am',1],['pm',2]]), class: (field_class(@user_event, :start_am_pm) + 'info_inline_control') %>
</div>
<div class="user_event_inline_container margin_left_ten padding_right_gone">
<%= f.label :end_time, "End", class: 'info_inline_control info_label five_margin_right' %>
<%= f.select :end_time, options_for_select([['1',1],['2',2],['3',3],['4',4],['5',5],['6',6],['7',7],['8',8],['9',9],['10',10],['11',11],['12',12]]), class: (field_class(@user_event, :end_time) + 'info_inline_control') %>
<%= f.select :end_time, options_for_select([['00',1],['15',2],['30',3],['45',4]]), class: (field_class(@user_event, :end_time) + 'info_inline_control') %>
<%= f.select :end_am_pm, options_for_select([['am',1],['pm',2]]), class: (field_class(@user_event, :end_am_pm) + 'info_inline_control') %>
</div>