Sha256: 714e34b0000f42945fa0b3ce240a07ccb81f3760a75860b799abe860af8f7b8b

Contents?: true

Size: 828 Bytes

Versions: 57

Compression:

Stored size: 828 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

      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 }
      end

    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
cm-admin-2.3.2 lib/cm_admin/models/nested_field.rb
cm-admin-2.3.1 lib/cm_admin/models/nested_field.rb
cm-admin-2.3.0 lib/cm_admin/models/nested_field.rb
cm-admin-2.2.1 lib/cm_admin/models/nested_field.rb
cm-admin-2.2.0 lib/cm_admin/models/nested_field.rb
cm-admin-2.1.5 lib/cm_admin/models/nested_field.rb
cm-admin-2.1.4 lib/cm_admin/models/nested_field.rb
cm-admin-2.1.3 lib/cm_admin/models/nested_field.rb
cm-admin-2.1.2 lib/cm_admin/models/nested_field.rb
cm-admin-2.1.1 lib/cm_admin/models/nested_field.rb
cm-admin-2.1.0 lib/cm_admin/models/nested_field.rb
cm-admin-2.0.2 lib/cm_admin/models/nested_field.rb
cm-admin-2.0.1 lib/cm_admin/models/nested_field.rb
cm-admin-2.0.0 lib/cm_admin/models/nested_field.rb
cm-admin-1.5.56 lib/cm_admin/models/nested_field.rb
cm-admin-1.5.55 lib/cm_admin/models/nested_field.rb
cm-admin-1.5.54 lib/cm_admin/models/nested_field.rb
cm-admin-1.5.53 lib/cm_admin/models/nested_field.rb
cm-admin-1.5.52 lib/cm_admin/models/nested_field.rb
cm-admin-1.5.51 lib/cm_admin/models/nested_field.rb