From d0de6fbe9d4087b89a8f7c31ba454ba38edc326d Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 29 Nov 2015 03:42:55 +0300 Subject: [PATCH] refactoring: split fs actions into generic and ui + fixed path prefix CSS presentation... Signed-off-by: Alex A. Naanou --- ui (gen4)/css/widget/browse.css | 2 +- ui (gen4)/lib/widget/browse.js | 7 ++++++ ui (gen4)/viewer.js | 43 +++++++++++++++++++++------------ 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/ui (gen4)/css/widget/browse.css b/ui (gen4)/css/widget/browse.css index ac12054e..856e0c3a 100755 --- a/ui (gen4)/css/widget/browse.css +++ b/ui (gen4)/css/widget/browse.css @@ -61,7 +61,7 @@ display: block; } .browse-widget:not(.flat) .path:not([contenteditable]):before { - content: "/"; + content: attr(prefix); } .browse-widget .path .dir { display: inline-block; diff --git a/ui (gen4)/lib/widget/browse.js b/ui (gen4)/lib/widget/browse.js index 3f1edb75..2e8a7146 100755 --- a/ui (gen4)/lib/widget/browse.js +++ b/ui (gen4)/lib/widget/browse.js @@ -128,6 +128,9 @@ var BrowserClassPrototype = { }) */ + if(options.pathPrefix){ + path.attr('prefix', options.pathPrefix) + } if(options.show_path == false){ path.hide() } @@ -557,6 +560,9 @@ var BrowserPrototype = { var p = browser.find('.path').empty() var l = browser.find('.list').empty() + // set the path prefix... + p.attr('prefix', this.options.pathPrefix) + var c = [] // fill the path field... path.forEach(function(e){ @@ -2096,6 +2102,7 @@ module.makePathList = function(elem, list, path){ } + /********************************************************************** * vim:set ts=4 sw=4 : */ return module }) diff --git a/ui (gen4)/viewer.js b/ui (gen4)/viewer.js index 59f03929..bc21f54d 100755 --- a/ui (gen4)/viewer.js +++ b/ui (gen4)/viewer.js @@ -3283,13 +3283,28 @@ var FileSystemLoaderActions = actions.Actions({ that.load(index) }) }], +}) - // XXX move this to the UI version of this feature... - // ...and make the UI version of .loadPath(..) run this if no - // path was given... - // XXX STUB: this dances around an issue in the browser -- removing - // the leading '/' on windows... - // ...fix in Browse(..) / Walk(..) + +var FileSystemLoader = +module.FileSystemLoader = ImageGridFeatures.Feature({ + title: '', + doc: '', + + tag: 'fs-loader', + + actions: FileSystemLoaderActions, + + isApplicable: function(){ + return window.nodejs != null + }, +}) + + + +//--------------------------------------------------------------------- + +var FileSystemLoaderUIActions = actions.Actions({ // XXX BUG: for some reason this when run from .browseActions(..) loads // incorrectly while when called directly is OK... browsePath: ['File/Browse file system...', @@ -3308,8 +3323,6 @@ var FileSystemLoaderActions = actions.Actions({ && parent.close && parent.close() - console.log('PATH:', path) - // pass the selected path on... if(callback){ callback(path) @@ -3328,18 +3341,15 @@ var FileSystemLoaderActions = actions.Actions({ }) -var FileSystemLoader = -module.FileSystemLoader = ImageGridFeatures.Feature({ +var FileSystemLoaderUI = +module.FileSystemLoaderUI = ImageGridFeatures.Feature({ title: '', doc: '', - tag: 'fs-loader', + tag: 'fs-loader-ui', + depends: ['fs-loader'], - actions: FileSystemLoaderActions, - - isApplicable: function(){ - return window.nodejs != null - }, + actions: FileSystemLoaderUIActions, }) @@ -3368,6 +3378,7 @@ ImageGridFeatures.Feature('viewer-testing', [ 'image-bookmarks', 'fs-loader', + 'fs-loader-ui', 'app-control', // chrome...