Class: Ezframe::SelectType
Instance Attribute Summary
Attributes inherited from TypeBase
#attribute, #error, #parent
Instance Method Summary
collapse
Methods inherited from TypeBase
#db_value, #form_html, get_class, #initialize, #key, #label, #multi_inputs?, #no_edit?, #no_view?, #normalize, type_name, #validate, #value, #value=
Instance Method Details
242
243
244
|
# File 'lib/ezframe/column_type.rb', line 242
def db_type
return "text"
end
|
234
235
236
237
238
239
240
|
# File 'lib/ezframe/column_type.rb', line 234
def form(opts = {})
return nil if no_edit? && !opts[:force]
h = { tag: "select", name: self.key, label: @attribute[:label], item: @attribute[:item], value: @value }
h[:class] = @attribute[:class] if @attribute[:class]
return h
end
|
#view(opts = {}) ⇒ Object
246
247
248
249
250
|
# File 'lib/ezframe/column_type.rb', line 246
def view(opts = {})
return nil if no_view? && !opts[:force]
item = @attribute[:item]
return item[@value]
end
|