Class: Ezframe::CheckboxType

Inherits:
TypeBase show all
Defined in:
lib/ezframe/column_type.rb

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, #make_error_box, #multi_inputs?, #no_edit?, #no_view?, #normalize, #type, type_name, #use_view_format, #validate, #value, #value=, #view

Constructor Details

This class inherits a constructor from Ezframe::TypeBase

Instance Method Details

#db_typeObject



354
355
356
# File 'lib/ezframe/column_type.rb', line 354

def db_type
  return "text"
end

#form(opts = {}) ⇒ Object



344
345
346
347
348
349
350
351
352
# File 'lib/ezframe/column_type.rb', line 344

def form(opts = {})
  return nil if no_edit? && !opts[:force]
  key = self.key
  key ="#{key}#{opts[:key_suffix]}" if opts[:key_suffix]
  h = Ht.checkbox(name: key, value: parent[:id].value, label: @attribute[:label])
  h[:class] = @attribute[:class] if @attribute[:class]
  h[:after] = make_error_box(key)
  return h
end