Class: Formatic::Time
- Inherits:
-
Base
show all
- Defined in:
- app/components/formatic/time.rb
Overview
Instance Method Summary
collapse
Methods inherited from Base
#input_name, #param_key, #value, #wrapper
#initialize
Instance Method Details
#hour_attribute_name ⇒ Object
55
56
57
|
# File 'app/components/formatic/time.rb', line 55
def hour_attribute_name
"#{f.object.model_name.param_key}[#{attribute_name}(4i)]"
end
|
63
64
65
|
# File 'app/components/formatic/time.rb', line 63
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.
43
44
45
|
# File 'app/components/formatic/time.rb', line 43
def label
false
end
|
#minute_attribute_name ⇒ Object
59
60
61
|
# File 'app/components/formatic/time.rb', line 59
def minute_attribute_name
"#{f.object.model_name.param_key}[#{attribute_name}(5i)]"
end
|
67
68
69
|
# File 'app/components/formatic/time.rb', line 67
def minute_input_id
"#{f.object.model_name.param_key}_#{attribute_name}_5i"
end
|
#options_for_hour ⇒ Object
47
48
49
|
# File 'app/components/formatic/time.rb', line 47
def options_for_hour
options_for_select collection_for_hour, f.object.public_send(attribute_name)&.hour
end
|
#options_for_minute ⇒ Object
51
52
53
|
# File 'app/components/formatic/time.rb', line 51
def options_for_minute
options_for_select collection_for_minute, f.object.public_send(attribute_name)&.min
end
|