class CmAdmin::Models::Section

def field(field_name, options={})

def field(field_name, options={})
  if @current_action.is_nested_field
    @nested_table_fields[@current_action.nested_table_name] ||= []
    @nested_table_fields[@current_action.nested_table_name] << CmAdmin::Models::Field.new(field_name, options)
  else
    @section_fields << CmAdmin::Models::Field.new(field_name, options)
  end
end

def form_field(field_name, options={}, arg=nil)

def form_field(field_name, options={}, arg=nil)
  if @current_action.is_nested_field
    @nested_table_fields[@current_action.nested_table_name] ||= []
    @nested_table_fields[@current_action.nested_table_name] << CmAdmin::Models::FormField.new(field_name, options[:input_type], options)
  else
    @section_fields << CmAdmin::Models::FormField.new(field_name, options[:input_type], options)
  end
end

def initialize(section_name, current_action, cm_model, display_if, col_size, &block)

def initialize(section_name, current_action, cm_model, display_if, col_size, &block)
  @section_fields = []
  @rows = []
  @nested_table_fields = {}
  @col_size = col_size
  @section_name = section_name
  @current_action = current_action
  @cm_model = cm_model
  @display_if = display_if || lambda { |arg| return true }
  instance_eval(&block)
end

def nested_form_field(field_name, &block)

def nested_form_field(field_name, &block)
  @current_action.is_nested_field = true
  @current_action.nested_table_name = field_name
  yield
end

def row(display_if: nil, &block)

def row(display_if: nil, &block)
  @rows ||= []
  @rows << CmAdmin::Models::Row.new(@current_action, @model, display_if, &block)
end