now makeUIDialog(..) is self-applicable...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-04-30 07:02:20 +03:00
parent a00cf871c4
commit 52450ccf29
2 changed files with 19 additions and 10 deletions

View File

@ -395,7 +395,7 @@ module.FileSystemLoader = core.ImageGridFeatures.Feature({
// XXX would need to delay the original action while the user is
// browsing...
var makeBrowseProxy = function(action, callback){
return function(path, logger){
return widgets.makeUIDialog(function(path, logger){
var that = this
path = path || this.location.path
// XXX should we set a start path here to current???
@ -405,7 +405,7 @@ var makeBrowseProxy = function(action, callback){
callback && callback.call(that, path)
return res
})
}
}, true)
}
@ -517,8 +517,9 @@ var FileSystemLoaderUIActions = actions.Actions({
// to start from.
// XXX should passing no path to this start browsing from the current
// path or from the root?
browseIndex: ['File/Load index', makeBrowseProxy('loadIndex')],
browseImages: ['File/Load images', makeBrowseProxy('loadImages')],
// XXX should these be dialog objects???
browseIndex: ['File/Load index...', makeBrowseProxy('loadIndex')],
browseImages: ['File/Load images...', makeBrowseProxy('loadImages')],
})

View File

@ -306,17 +306,25 @@ module.makeUIContainer = function(make){
return f
}
// XXX should this be self-applicable???
// ...this would need to detect if it's launched from a container...
var makeUIDialog =
module.makeUIDialog = function(make){
module.makeUIDialog = function(make, bare){
var f = function(){
var args = [].slice.call(arguments)
// see if the first arg is a container spec...
var container = this.uiContainers.indexOf(args[0]) >= 0 ?
args.shift()
: (this.config['ui-default-container'] || 'Overlay')
// wrap an existing dialog...
if(bare){
return make.apply(this, args)
return this[container](make.apply(this, args)).client
} else {
// see if the first arg is a container spec...
var container = this.uiContainers.indexOf(args[0]) >= 0 ?
args.shift()
: (this.config['ui-default-container'] || 'Overlay')
return this[container](make.apply(this, args)).client
}
}
f.__dialog__ = true
return f