extensions/angoose-ui/directives/ang-field.js
function mapTemplate(path, pathSchema, modelSchema){
    if(pathSchema.options.template) return pathSchema.options.template;
    if(pathSchema.options.multiline) return "textarea"
    var template = 'input';
    var opts = pathSchema.options || {};
    //@todo: refactor them into subclasses
    
    switch(pathSchema.instance || (pathSchema.options && pathSchema.options.type)){
        case 'ObjetcID':
            if(opts.ref)    template = 'selector';
            break; 
        case 'Boolean':
            template = 'checkbox';
            break;
        case 'Date':
        case 'String':
        case 'Number':
        default:
            break;
    }
    if(getRef(pathSchema))
        template = "selector";
    if(Array.isArray(opts['enum']) && opts['enum'].length>0){
        template = "select";
    }
    if(Array.isArray(opts.type )){
        if(pathSchema.caster){
            /** array of simple types */
           // console.log("Simple types", pathSchema)
        }
    }
    
    angoose.logger.trace("Path ", path, " Type ", pathSchema , " template: ", template)
    return template;
}
function mapTemplate(path, pathSchema, modelSchema){
    if(pathSchema.options.template) return pathSchema.options.template;
    if(pathSchema.options.multiline) return "textarea"
    var template = 'input';
    var opts = pathSchema.options || {};
    //@todo: refactor them into subclasses
    
    switch(pathSchema.instance || (pathSchema.options && pathSchema.options.type)){
        case 'ObjetcID':
            if(opts.ref)    template = 'selector';
            break; 
        case 'Boolean':
            template = 'checkbox';
            break;
        case 'Date':
        case 'String':
        case 'Number':
        default:
            break;
    }
    if(getRef(pathSchema))
        template = "selector";
    if(Array.isArray(opts['enum']) && opts['enum'].length>0){
        template = "select";
    }
    if(Array.isArray(opts.type )){
        if(pathSchema.caster){
            /** array of simple types */
           // console.log("Simple types", pathSchema)
        }
    }
    
    angoose.logger.trace("Path ", path, " Type ", pathSchema , " template: ", template)
    return template;
}
function mapTemplate ( path , pathSchema , modelSchema ) { if ( pathSchema . options . template ) return pathSchema . options . template ; if ( pathSchema . options . multiline ) return "textarea" var template = 'input' ; var opts = pathSchema . options || { } ; //@todo: refactor them into subclasses switch ( pathSchema . instance || ( pathSchema . options && pathSchema . options . type ) ) { case 'ObjetcID' : if ( opts . ref ) template = 'selector' ; break ; case 'Boolean' : template = 'checkbox' ; break ; case 'Date' : case 'String' : case 'Number' : default : break ; } if ( getRef ( pathSchema ) ) template = "selector" ; if ( Array . isArray ( opts [ 'enum' ] ) && opts [ 'enum' ] . length > 0 ) { template = "select" ; } if ( Array . isArray ( opts . type ) ) { if ( pathSchema . caster ) { /** array of simple types */ // console.log("Simple types", pathSchema) } } angoose . logger . trace ( "Path " , path , " Type " , pathSchema , " template: " , template ) return template ; }
** mapTemplate **  Default mapping for Mongoose schema type -> form field  - ObjectID: selector - Boolean: Checkbox - String: input - Number: input - Date: ? - Array of simple types: selector multi - Array of ref objects: selector multi - String/Number with enum values:  Select - Mixed: ??
** mapTemplate ** Default mapping for Mongoose schema type - > form field - ObjectID : selector - Boolean : Checkbox - String : input - Number : input - Date : ? - Array of simple types : selector multi - Array of ref objects : selector multi - String / Number with enum values : Select - Mixed : ??