Class: Formatic::Time
- Inherits:
-
Base
show all
- Defined in:
- app/components/formatic/time.rb
Overview
Instance Method Summary
collapse
Methods inherited from Base
#data, #input_name, #param_key, #value, #wrapper
#initialize
Instance Method Details
#hour_attribute_name ⇒ Object
57
58
59
|
# File 'app/components/formatic/time.rb', line 57
def hour_attribute_name
"#{f.object.model_name.param_key}[#{attribute_name}(4i)]"
end
|
65
66
67
|
# File 'app/components/formatic/time.rb', line 65
def hour_input_id
"#{f.object.model_name.param_key}_#{attribute_name}_4i"
end
|
#label ⇒ Object
Usually the time component is used below the date component (for a DateTime attribute).
So, normally we don't want the label to be shown twice.
45
46
47
|
# File 'app/components/formatic/time.rb', line 45
def label false
end
|
#minute_attribute_name ⇒ Object
61
62
63
|
# File 'app/components/formatic/time.rb', line 61
def minute_attribute_name
"#{f.object.model_name.param_key}[#{attribute_name}(5i)]"
end
|
69
70
71
|
# File 'app/components/formatic/time.rb', line 69
def minute_input_id
"#{f.object.model_name.param_key}_#{attribute_name}_5i"
end
|
#options_for_hour ⇒ Object
49
50
51
|
# File 'app/components/formatic/time.rb', line 49
def options_for_hour
options_for_select collection_for_hour, f.object.public_send(attribute_name)&.hour
end
|
#options_for_minute ⇒ Object
53
54
55
|
# File 'app/components/formatic/time.rb', line 53
def options_for_minute
options_for_select collection_for_minute, f.object.public_send(attribute_name)&.min
end
|