From 4b632bc3bf03d4d8b4b2a3ed0adc471b56611a3d Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 5 Dec 2015 07:37:13 +0300 Subject: [PATCH] couple of fixed + tweaking base path (still does not feel right)... Signed-off-by: Alex A. Naanou --- ui (gen4)/file.js | 11 +++++++++-- ui (gen4)/viewer.js | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ui (gen4)/file.js b/ui (gen4)/file.js index a6c3f34c..dc4714bb 100755 --- a/ui (gen4)/file.js +++ b/ui (gen4)/file.js @@ -370,7 +370,7 @@ function(path, index_dir, logger){ }) // collect the found indexes... .on('match', function(path){ - loaders.push(loadIndex(path, logger) + loaders.push(loadIndex(path, index_dir, logger) .then(function(obj){ // NOTE: considering that all the paths within // the index are relative to the preview @@ -558,6 +558,7 @@ module.buildIndex = function(index, base_path){ // NOTE: this will prepare for version 2.0 file structure... // // XXX write tags, marks and bookmarks only if changed... +// XXX this is not yet correct... var prepareIndex = module.prepareIndex = function(json, changes){ @@ -571,7 +572,13 @@ function(json, changes){ // NOTE: we write the whole set ONLY if an item is true or undefined // i.e. not false... if(changes.bookmarked !== false){ - res.bookmarked = json.data.tags.bookmark + res.bookmarked = [ + json.data.tags.bookmark, + // NOTE: this is for bookmark metadata line comments, text, + // tags, ... etc. + // XXX currently this is not used... + json.data.bookmark_data || {}, + ] } if(changes.selected !== false){ diff --git a/ui (gen4)/viewer.js b/ui (gen4)/viewer.js index a1c477ab..1b5c38d9 100755 --- a/ui (gen4)/viewer.js +++ b/ui (gen4)/viewer.js @@ -3337,6 +3337,7 @@ var FileSystemLoaderActions = actions.Actions({ }, // XXX need to revise these... + // XXX should there be a loaded path and a requested path??? base_path: null, loaded_paths: null, @@ -3430,18 +3431,22 @@ var FileSystemLoaderActions = actions.Actions({ index.images.join(part.images) } + loaded.push(k) + // XXX do a better merge and remove this... // ...we either need to lazy-load clustered indexes // or merge, in both cases base_path should reflet // the fact that we have multiple indexes... - base_path = k break } logger && logger.emit('load index', index) that.loaded_paths = loaded - that.base_path = base_path + // XXX should we get the requested path or the base path currently loaded + //that.base_path = loaded.length == 1 ? loaded[0] : path + that.base_path = loaded.length == 1 ? loaded[0] : path + that.load(index) }) }], @@ -3468,8 +3473,8 @@ var FileSystemLoaderActions = actions.Actions({ }], clear: [function(){ - this.base_path = null - this.loaded_paths = null + delete this.base_path + delete this.loaded_paths }], }) @@ -3667,6 +3672,10 @@ var FileSystemWriterActions = actions.Actions({ if(path == null){ return } + + // XXX get a logger... + logger = logger || this.logger + // XXX get real base path... path = path || this.base_path +'/'+ this.config['index-dir']