mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
tweaking .batch(..)
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
c0dd13342a
commit
5865acdfc6
@ -939,6 +939,13 @@ var ExampleUIActions = actions.Actions({
|
|||||||
//make.field.Toggle('Toggle: ', 'on')
|
//make.field.Toggle('Toggle: ', 'on')
|
||||||
make.field.Toggle('Toggle: ', data)
|
make.field.Toggle('Toggle: ', data)
|
||||||
|
|
||||||
|
// XXX need more testing...
|
||||||
|
make.batch([
|
||||||
|
['X', 'Y'],
|
||||||
|
{text: 'foo', value: 123},
|
||||||
|
{type: 'field.Toggle', text: 'Batch toggle: '},
|
||||||
|
])
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
cls: 'table-view',
|
cls: 'table-view',
|
||||||
}) })],
|
}) })],
|
||||||
|
|||||||
@ -1034,7 +1034,6 @@ browse.items.makeSubContext = function(name, obj){
|
|||||||
// XXX Q: should title/value args be optional???
|
// XXX Q: should title/value args be optional???
|
||||||
// ...and should we break the make(..) convention of passing an arg
|
// ...and should we break the make(..) convention of passing an arg
|
||||||
// array for multiple .text blocks, i.e. make([title, value], ...)??
|
// array for multiple .text blocks, i.e. make([title, value], ...)??
|
||||||
//browse.items.Field =
|
|
||||||
browse.items.makeSubContext('field',
|
browse.items.makeSubContext('field',
|
||||||
function(title, value, options){
|
function(title, value, options){
|
||||||
options = options || {}
|
options = options || {}
|
||||||
@ -1207,38 +1206,36 @@ function(title, options){
|
|||||||
// XXX like .makeEditor(..) but local to make(..) (i.e. generic)...
|
// XXX like .makeEditor(..) but local to make(..) (i.e. generic)...
|
||||||
// XXX should we have a batch callback???
|
// XXX should we have a batch callback???
|
||||||
// ...otherwise what's the point in this?
|
// ...otherwise what's the point in this?
|
||||||
// XXX TEST...
|
|
||||||
//browse.items.makeEditor =
|
//browse.items.makeEditor =
|
||||||
browse.items.batch =
|
browse.items.batch =
|
||||||
function(spec, callback){
|
function(spec, callback){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
// build the fields...
|
// build the fields...
|
||||||
;(spec || [])
|
;(spec || [])
|
||||||
.forEach(function(field){
|
.forEach(function(field){
|
||||||
// array...
|
// array...
|
||||||
field instanceof Array ?
|
field instanceof Array ?
|
||||||
make(...field)
|
that(...field)
|
||||||
// spec...
|
// spec...
|
||||||
: field instanceof Object ?
|
: field instanceof Object ?
|
||||||
// XXX add support for field paths...
|
(field.type || 'field')
|
||||||
//filed.type.split('.')
|
// handle field paths...
|
||||||
// .reduce(function(res, cur){
|
.split('.')
|
||||||
// return res[cur] }, this)(field.text, field)
|
.reduce(function(res, cur){
|
||||||
this[field.type || 'field'](field.text, field)
|
that = res
|
||||||
|
return res[cur] }, that)
|
||||||
|
// XXX revise this...
|
||||||
|
.call(that, field.text, field)
|
||||||
// other...
|
// other...
|
||||||
: make(field) })
|
: that(field) })
|
||||||
|
|
||||||
// batch callback...
|
// batch callback...
|
||||||
callback
|
callback
|
||||||
&& this.dialog
|
&& this.dialog
|
||||||
.close(function(){
|
.close(function(){
|
||||||
// XXX get the field data...
|
// XXX get the field data and pass it to the callback...
|
||||||
// XXX
|
// XXX
|
||||||
})
|
})
|
||||||
|
return this }
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user