From 52450ccf29aea6ba1781149fa761ccc4bda1fe2d Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 30 Apr 2016 07:02:20 +0300 Subject: [PATCH] now makeUIDialog(..) is self-applicable... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/filesystem.js | 9 +++++---- ui (gen4)/features/ui-widgets.js | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/ui (gen4)/features/filesystem.js b/ui (gen4)/features/filesystem.js index 5e8259bf..f8afa7ca 100755 --- a/ui (gen4)/features/filesystem.js +++ b/ui (gen4)/features/filesystem.js @@ -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')], }) diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 44f3812c..f148e79e 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -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