Class: Ez::Resources::FieldCell
Constant Summary
ApplicationCell::CSS_SCOPE
Instance Method Summary
collapse
#css_for, #custom_css_map, #div_for, form, #t
Instance Method Details
#base_options ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/cells/ez/resources/field_cell.rb', line 20
def base_options
{
label: model.title,
as: model.type,
collection: model.collection,
include_blank: model.required?,
required: model.required?,
readonly: options[:readonly],
checked_value: true.to_s,
unchecked_value: false.to_s,
wrapper: model.wrapper,
right_label: model.suffix,
input_html: {
min: model.min
}
}.merge(model.options)
end
|
#html_options ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/cells/ez/resources/field_cell.rb', line 6
def html_options
if options[:new_record?]
base_options.merge(
selected: model.default&.call,
input_html: {
value: model.default&.call,
checked: model.default&.call
}
)
else
base_options
end
end
|