From 1c9805f05c103bee75c2fcf953ef8f343cf82321 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 15 Aug 2017 16:53:55 +0300 Subject: [PATCH] experimenting with collections... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/collections.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ui (gen4)/features/collections.js b/ui (gen4)/features/collections.js index ac224fc6..c1236531 100755 --- a/ui (gen4)/features/collections.js +++ b/ui (gen4)/features/collections.js @@ -26,6 +26,8 @@ var CollectionActions = actions.Actions({ get collection(){ return this.location.collection }, + set collection(value){ + this.loadCollection(value) }, // XXX might be a good idea to make collection loading part of the @@ -57,9 +59,8 @@ var CollectionActions = actions.Actions({ saveCollection: ['- Collections/Save collection', core.doc`Save current state to collection`, function(collection){ - collection = collection || this.location.collection + collection = collection || this.collection - // XXX should there be a default??? if(collection == null){ return } @@ -69,6 +70,7 @@ var CollectionActions = actions.Actions({ collections[collection] = { title: collection, + // XXX we need to trim .order to only the current images??? data: this.data.clone(), } }], @@ -77,6 +79,10 @@ var CollectionActions = actions.Actions({ inCollections: ['- Image/', core.doc`Get list of collections containing item`, function(gid){ + var that = this + return Object.keys(this.collections || {}) + .filter(function(c){ + return that.collections[c].data.order.indexOf(gid) >= 0 }) }], toCollection: ['- Collections/', core.doc`Add items to collection`, @@ -94,6 +100,7 @@ var CollectionActions = actions.Actions({ console.log('>>>', gids) + // XXX add to collection... // XXX }],