mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
experimenting with collections...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
4f6ec238d7
commit
1c9805f05c
@ -26,6 +26,8 @@ var CollectionActions = actions.Actions({
|
|||||||
|
|
||||||
get collection(){
|
get collection(){
|
||||||
return this.location.collection },
|
return this.location.collection },
|
||||||
|
set collection(value){
|
||||||
|
this.loadCollection(value) },
|
||||||
|
|
||||||
|
|
||||||
// XXX might be a good idea to make collection loading part of the
|
// 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',
|
saveCollection: ['- Collections/Save collection',
|
||||||
core.doc`Save current state to collection`,
|
core.doc`Save current state to collection`,
|
||||||
function(collection){
|
function(collection){
|
||||||
collection = collection || this.location.collection
|
collection = collection || this.collection
|
||||||
|
|
||||||
// XXX should there be a default???
|
|
||||||
if(collection == null){
|
if(collection == null){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -69,6 +70,7 @@ var CollectionActions = actions.Actions({
|
|||||||
collections[collection] = {
|
collections[collection] = {
|
||||||
title: collection,
|
title: collection,
|
||||||
|
|
||||||
|
// XXX we need to trim .order to only the current images???
|
||||||
data: this.data.clone(),
|
data: this.data.clone(),
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
@ -77,6 +79,10 @@ var CollectionActions = actions.Actions({
|
|||||||
inCollections: ['- Image/',
|
inCollections: ['- Image/',
|
||||||
core.doc`Get list of collections containing item`,
|
core.doc`Get list of collections containing item`,
|
||||||
function(gid){
|
function(gid){
|
||||||
|
var that = this
|
||||||
|
return Object.keys(this.collections || {})
|
||||||
|
.filter(function(c){
|
||||||
|
return that.collections[c].data.order.indexOf(gid) >= 0 })
|
||||||
}],
|
}],
|
||||||
toCollection: ['- Collections/',
|
toCollection: ['- Collections/',
|
||||||
core.doc`Add items to collection`,
|
core.doc`Add items to collection`,
|
||||||
@ -94,6 +100,7 @@ var CollectionActions = actions.Actions({
|
|||||||
|
|
||||||
console.log('>>>', gids)
|
console.log('>>>', gids)
|
||||||
|
|
||||||
|
// XXX add to collection...
|
||||||
// XXX
|
// XXX
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user