Sha256: ecf437fbae5827e262736602462dfc819eaf7e4e18b6f8cc071677974d446176

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 KB

Contents

require 'kitsune/builder'

module Kitsune
  module MongoMapper  
    def setup_admin
      self.class_eval do
        class_inheritable_hash :kitsune_admin
        self.kitsune_admin = {
          :no_admin => false, 
          :multipart => false, 
          :display => {}, 
          :edit => {}, 
          :reflections => {},
          :fields => {}, 
          :tabs => {},
          :is_sti => false,
					:disabled => [],
					:versioned => false,
					:order_by => nil,
					:media => nil # class to store images into
        }
      end
    end
  
    def admin &block
      setup_admin unless self.respond_to?(:kitsune_admin)
      Kitsune::Builder.generate(self, &block) unless self.kitsune_admin[:no_admin]
    end
  
    def no_admin
      setup_admin
      self.kitsune_admin[:no_admin] = true
    end
    TRANSPOSE = {String => :string}
    def columns
      self.keys.map do |key, value|
        FauxColumn.new(key, TRANSPOSE[value.type], key == '_id')
      end
    end
    
    def reflections
      {}
    end
    
    def class_name
      self.to_s
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
ds-kitsune-0.2.5 lib/kitsune/mongo_mapper.rb
ds-kitsune-0.2.3 lib/kitsune/mongo_mapper.rb
kitsune-0.2.1 lib/kitsune/mongo_mapper.rb
kitsune-0.2.0 lib/kitsune/mongo_mapper.rb
kitsune-0.1.5 lib/kitsune/mongo_mapper.rb
kitsune-0.1.4 lib/kitsune/mongo_mapper.rb
kitsune-0.1.3 lib/kitsune/mongo_mapper.rb
kitsune-0.1.2 lib/kitsune/mongo_mapper.rb
kitsune-0.1.1 lib/kitsune/mongo_mapper.rb
kitsune-0.1.0 lib/kitsune/mongo_mapper.rb