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

View File

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