Sha256: cd93a3872dea5591ff874e7ee0c932256b196ed988e8e754f256f07ecfb1db85

Contents?: true

Size: 684 Bytes

Versions: 22

Compression:

Stored size: 684 Bytes

Contents

module CmAdmin
  module Models
    class NestedField

      # NestedField is like a container to hold Field and FormField object

      attr_accessor :field_name, :display_type, :fields, :associated_fields, :parent_field, :header, :label, :submit_text

      def initialize(field_name, attributes={})
        @field_name = field_name
        set_default_values
        attributes.each do |key, value|
          self.send("#{key.to_s}=", value)
        end
      end

      def set_default_values
        self.display_type = :table
        self.fields = []
        self.associated_fields = []
        self.submit_text = "+ Add #{@field_name.to_s.titleize}"
      end

    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
cm-admin-1.5.0 lib/cm_admin/models/nested_field.rb
cm-admin-1.4.9 lib/cm_admin/models/nested_field.rb
cm-admin-1.4.8 lib/cm_admin/models/nested_field.rb
cm-admin-1.4.7 lib/cm_admin/models/nested_field.rb
cm-admin-1.4.6 lib/cm_admin/models/nested_field.rb
cm-admin-1.4.5 lib/cm_admin/models/nested_field.rb
cm-admin-1.4.4 lib/cm_admin/models/nested_field.rb
cm-admin-1.4.3 lib/cm_admin/models/nested_field.rb
cm-admin-1.4.2 lib/cm_admin/models/nested_field.rb
cm-admin-1.4.1 lib/cm_admin/models/nested_field.rb
cm-admin-1.4.0 lib/cm_admin/models/nested_field.rb
cm-admin-1.3.9 lib/cm_admin/models/nested_field.rb
cm-admin-1.3.8 lib/cm_admin/models/nested_field.rb
cm-admin-1.3.7 lib/cm_admin/models/nested_field.rb
cm-admin-1.3.6 lib/cm_admin/models/nested_field.rb
cm-admin-1.3.5 lib/cm_admin/models/nested_field.rb
cm-admin-1.3.4 lib/cm_admin/models/nested_field.rb
cm-admin-1.3.3 lib/cm_admin/models/nested_field.rb
cm-admin-1.3.2 lib/cm_admin/models/nested_field.rb
cm-admin-1.3.1 lib/cm_admin/models/nested_field.rb