Class: Netzke::Basepack::FieldConfig
- Inherits:
-
AttrConfig
- Object
- ActiveSupport::OrderedOptions
- AttrConfig
- Netzke::Basepack::FieldConfig
- Defined in:
- lib/netzke/basepack/field_config.rb
Overview
Takes care of automatic field configuration in Form::Base
Instance Method Summary collapse
Methods inherited from AttrConfig
#association?, #initialize, #primary?, #set_read_only
Constructor Details
This class inherits a constructor from Netzke::Basepack::AttrConfig
Instance Method Details
#merge_attribute(attr) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/netzke/basepack/field_config.rb', line 5 def merge_attribute(attr) self.merge!(attr) self.field_label = self.delete(:label) if self.has_key?(:label) self.merge!(delete(:field_config)) if self.has_key?(:field_config) self.merge!(editor_config) if self.has_key?(:editor_config) self.delete(:column_config) if self.has_key?(:column_config) end |
#set_defaults ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/netzke/basepack/field_config.rb', line 17 def set_defaults super self.type ||= @model_adapter.attr_type(name) set_xtype if xtype.nil? self.field_label ||= default_label self.hidden = true if hidden.nil? && primary? self.hide_label = hidden if hide_label.nil? case type when :boolean configure_checkbox when :date configure_date_field end end |