a tiny refactoring

This commit is contained in:
John Bintz 2013-01-25 08:43:02 -05:00
parent eb7fdc6e10
commit 1e3b1acbdd
1 changed files with 10 additions and 2 deletions

View File

@ -2,8 +2,8 @@ class SeparateDateAndTimePickerInput < Formtastic::Inputs::DatetimePickerInput
def to_html
input_wrapping do
label_html <<
builder.text_field("#{method}(date)", date_input_html_options) <<
builder.text_field("#{method}(time)", time_input_html_options)
builder.text_field(date_method, date_input_html_options) <<
builder.text_field(time_method, time_input_html_options)
end
end
@ -16,6 +16,14 @@ class SeparateDateAndTimePickerInput < Formtastic::Inputs::DatetimePickerInput
{ 'type' => 'time', 'value' => time_value }
end
def date_method
"#{method}(date)"
end
def time_method
"#{method}(time)"
end
def date_value
value_parts.first
end