From c0dd13342adde534883f95e79c38c04b4795fcd5 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 19 Dec 2019 18:44:52 +0300 Subject: [PATCH] adding make.batch(..) Signed-off-by: Alex A. Naanou --- ui (gen4)/features/ui-widgets.js | 33 ++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index b62da883..5a1dff0a 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -1205,10 +1205,39 @@ function(title, options){ // XXX like .makeEditor(..) but local to make(..) (i.e. generic)... +// XXX should we have a batch callback??? +// ...otherwise what's the point in this? +// XXX TEST... //browse.items.makeEditor = -browse.items.makeBatch = +browse.items.batch = function(spec, callback){ - // XXX + var that = this + + // build the fields... + ;(spec || []) + .forEach(function(field){ + // array... + field instanceof Array ? + make(...field) + // spec... + : field instanceof Object ? + // XXX add support for field paths... + //filed.type.split('.') + // .reduce(function(res, cur){ + // return res[cur] }, this)(field.text, field) + this[field.type || 'field'](field.text, field) + // other... + : make(field) }) + + // batch callback... + callback + && this.dialog + .close(function(){ + // XXX get the field data... + // XXX + }) + + return this }