Skip to content

Commit

Permalink
Added initial partial support for Array inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
surdu committed Jun 17, 2015
1 parent 8308245 commit f2881be
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"immed": true,
"noarg": true,
"undef": true,
"unused": "strict",
"quotmark": "double",
"unused": true,
"node": true
}
10 changes: 9 additions & 1 deletion parsers/mongoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var typeMappings = {
"String": "text",
"Date": "date",
"Number": "number",
"Array": "select"
};

function MongooseParser() {
Expand All @@ -15,7 +16,14 @@ MongooseParser.prototype = {
var fields = [];
for (var fieldName in model.schema.paths) {
var mongoField = model.schema.paths[fieldName];
var formlessOptions = mongoField.options.formless || {};
var formlessOptions;

if (mongoField.instance !== "Array") {
formlessOptions = mongoField.options.formless || {};
}
else {
formlessOptions = mongoField.options.type[0].formless || {};
}

if (formlessOptions.ignore || this.ignoreFields.indexOf(mongoField.path) !== -1) {
continue;
Expand Down
2 changes: 2 additions & 0 deletions specs/form-spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// jshint jasmine: true

"use strict";

var Form = require("../formless");

var basicForm = require("./assets/basicForm");
Expand Down

0 comments on commit f2881be

Please sign in to comment.