Class: Ezframe::SelectType
Instance Attribute Summary
Attributes inherited from TypeBase
#attribute, #error, #parent
Instance Method Summary
collapse
Methods inherited from TypeBase
#db_value, get_class, #initialize, #key, #label, #multi_inputs?, #no_edit?, #no_view?, #normalize, #type, type_name, #use_view_format, #value, #value=
Instance Method Details
317
318
319
|
# File 'lib/ezframe/column_type.rb', line 317
def db_type
return "text"
end
|
309
310
311
312
313
314
315
|
# File 'lib/ezframe/column_type.rb', line 309
def form(opts = {})
return nil if no_edit? && !opts[:force]
@items ||= @attribute[:item]
h = { tag: "select", class: %w[browser-default], name: self.key, label: @attribute[:label], item: @items, value: @value }
h[:class] = @attribute[:class] if @attribute[:class]
return h
end
|
#validate(val) ⇒ Object
329
330
331
|
# File 'lib/ezframe/column_type.rb', line 329
def validate(val)
return nil
end
|
#view(opts = {}) ⇒ Object
321
322
323
324
325
326
327
|
# File 'lib/ezframe/column_type.rb', line 321
def view(opts = {})
return nil if no_view? && !opts[:force]
item = @attribute[:item]
return nil unless @value
return item[@value.to_s.to_sym]
end
|