Sha256: 61dfd5cd2481f577ca5b4558265d353d3ccc4afd3c6c36ca6de56e1320a1c333

Contents?: true

Size: 927 Bytes

Versions: 25

Compression:

Stored size: 927 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, :is_deletable, :is_creatable, :is_positionable

      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}"
        self.is_deletable = lambda { |arg| return true }
        self.is_creatable = lambda { |arg| return true }
        self.is_positionable = lambda { |arg| return false }
      end

    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
cm-admin-3.0.15 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.14 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.13 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.12 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.11 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.10 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.9 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.8 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.7 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.6 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.5 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.4 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.3 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.2 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.1 lib/cm_admin/models/nested_field.rb
cm-admin-3.0.0 lib/cm_admin/models/nested_field.rb
cm-admin-2.4.6 lib/cm_admin/models/nested_field.rb
cm-admin-2.4.5 lib/cm_admin/models/nested_field.rb
cm-admin-2.4.4 lib/cm_admin/models/nested_field.rb
cm-admin-2.4.3 lib/cm_admin/models/nested_field.rb