Sha256: 3385a7dde81210f3876edf8a3212f6b46a18d80a96fb088a8185095ed8f93039

Contents?: true

Size: 686 Bytes

Versions: 6

Compression:

Stored size: 686 Bytes

Contents

module CmAdmin
  module Models
    class Field

      attr_accessor :field_name, :label, :header, :field_type, :format, :precision, :height,
        :width, :helper_method, :preview, :custom_link, :precision, :prefix, :suffix, :tag_class

      def initialize(field_name, attributes = {})
        @field_name = field_name
        set_default_values
        attributes.each do |key, value|
          self.send("#{key.to_s}=", value)
        end
        self.height = 50 if self.field_type == :image && self.height.nil?
        self.width = 50 if self.field_type == :image && self.width.nil?
      end

      def set_default_values
        self.tag_class = {}
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cm-admin-0.8.5 lib/cm_admin/models/field.rb
cm-admin-0.8.4 lib/cm_admin/models/field.rb
cm-admin-0.8.3 lib/cm_admin/models/field.rb
cm-admin-0.8.2 lib/cm_admin/models/field.rb
cm-admin-0.8.1 lib/cm_admin/models/field.rb
cm-admin-0.8.0 lib/cm_admin/models/field.rb