Skip to content

Instantly share code, notes, and snippets.

@solisoft
Last active October 4, 2016 15:14
Show Gist options
  • Save solisoft/6d241d0a9f3e1a8f7a997392f89135b1 to your computer and use it in GitHub Desktop.
Save solisoft/6d241d0a9f3e1a8f7a997392f89135b1 to your computer and use it in GitHub Desktop.
var loadFields = function() {
// { r: new_row, c: classname, n: name/id, t: type, j: joi validation, l: label, d: data list }
fields = [
{ r: true, c: "1-1", n: "title", t: "string", j: joi.string().required(), l: "Title" },
{ r: true, c: "1-2", n: "date", t: "date", j: joi.string().required(), l: "Publishing Date" },
{ r: false, c: "1-2", n: "draft", t: "list", j: joi.string().required(), l: "Draft?", d: [["y", "Yes"], ["n", "No"]] },
{ r: true, c: "1-1", n: "text", t: "text", j: joi.string().required(), l: "Text"}
]
schema = {}
each(fields, function(f) {
schema[f.n] = f.j
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment