tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-10-18 13:11:54 +03:00
parent 28fac49755
commit dcdd78489c
4 changed files with 33 additions and 5 deletions

View File

@ -691,6 +691,7 @@ core.ImageGridFeatures.Feature({
var img = images.Images(json.images)
// this is needed for loading multiple indexes...
if(base_path){
d.base_path = base_path
// XXX STUB remove ASAP...
@ -704,6 +705,7 @@ core.ImageGridFeatures.Feature({
// 2) add/remove on load/save (approach below)
// + less to do in real time
// - more processing on load/save
//console.warn('STUB: setting image .base_path in .prepareJSONForLoad(..)')
img.forEach(function(_, img){ img.base_path = base_path })
}

View File

@ -60,6 +60,9 @@ module.COLLECTION_TRANSFER_CHANGES = [
]
//---------------------------------------------------------------------
// XXX undo...
var CollectionActions = actions.Actions({
config: {
@ -1331,7 +1334,8 @@ module.Collection = core.ImageGridFeatures.Feature({
// simplify lazy-loading of the collection
// index...
if(changes && (changes === true || changes.collections)){
var index = res.index['collection-index'] = {}
//var index = res.index['collection-index'] = {}
var index = res.index['collections'] = {}
// NOTE: we do not need to use .collection_order here
// as .json(..) returns the collections in the
// correct order...
@ -1400,9 +1404,10 @@ module.Collection = core.ImageGridFeatures.Feature({
// collection index...
var collections = {}
var collections_index = {}
var index = json['collection-index']
//var index = json['collection-index']
var index = json['collections']
index
&& index.forEach(function(gid){
&& Object.keys(index).forEach(function(gid){
var title = index[gid]
var path = 'collections/'+ gid
@ -1415,6 +1420,12 @@ module.Collection = core.ImageGridFeatures.Feature({
}
})
if(Object.keys(collections).length > 0){
//console.log('!!!!!', collections)
// XXX this breaks loading...
//res.collections = collections
}
// group collection data...
// XXX would be nice to have a mechanism to pass info to
// the loader on what paths to load without actually
@ -1691,7 +1702,7 @@ module.CollectionTags = core.ImageGridFeatures.Feature({
// skip loaded collections that are already Data objects...
// XXX not sure about this...
.filter(function(title){
return !(json.collections[title] instanceof data.Data) })
return !(json.collections[title].data instanceof data.Data) })
// do the loading...
.forEach(function(title){
var c = that.collections[title]

View File

@ -340,10 +340,23 @@ var LocationActions = actions.Actions({
}}],
load: [function(){
return function(_, data){
var that = this
// NOTE: we are setting this after the load because the
// loader may .clear() the viewer, thus clearing the
// .location too...
this.__location = data.location
var l = this.__location = data.location
// set default image .base_path
// XXX not sure we need this...
data.location
&& Object.keys(this.images || {}).forEach(function(gid){
var img = that.images[gid]
if(img.base_path == null){
img.base_path = l.path
}
})
}}],
clone: [function(){
return function(res){

View File

@ -278,6 +278,8 @@ function(list, from_date, logger){
var k = s[1]
var d = s[2] == 'diff'
k = d ? k : s.slice(1).join('-')
// new keyword...
if(index[k] == null){
index[k] = [[d, n]]