mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
more cleanup + fixes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
74304d36f5
commit
9e18c06806
@ -23,8 +23,10 @@ var widgets = require('features/ui-widgets')
|
|||||||
// XXX should collections be in the Crop menu????
|
// XXX should collections be in the Crop menu????
|
||||||
|
|
||||||
// XXX things we need to do to collections:
|
// XXX things we need to do to collections:
|
||||||
// - add images from current state
|
// - remove images (from collection) ????
|
||||||
// - remove images (from collection)
|
// - auto-collections
|
||||||
|
// - tags -- adding/removing images adds/removes tags
|
||||||
|
// - ribbons -- top / bottom / n-m / top+2 / ..
|
||||||
// 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
|
||||||
// .load(..) protocol...
|
// .load(..) protocol...
|
||||||
// ...this could be done via a url suffix, as a shorthand.
|
// ...this could be done via a url suffix, as a shorthand.
|
||||||
@ -55,9 +57,6 @@ var CollectionActions = actions.Actions({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.crop(this.collections[collection].data)
|
this.crop(this.collections[collection].data)
|
||||||
|
|
||||||
// XXX need to clear this when exiting crop...
|
|
||||||
this.location.collection = collection
|
|
||||||
}],
|
}],
|
||||||
saveCollection: ['- Collections/',
|
saveCollection: ['- Collections/',
|
||||||
core.doc`Save current state to collection
|
core.doc`Save current state to collection
|
||||||
@ -87,7 +86,10 @@ var CollectionActions = actions.Actions({
|
|||||||
(new this.data.constructor())
|
(new this.data.constructor())
|
||||||
: this.data
|
: this.data
|
||||||
.clone()
|
.clone()
|
||||||
.removeUnloadedGids(),
|
.removeUnloadedGids()
|
||||||
|
.run(function(){
|
||||||
|
this.collection = collection
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
newCollection: ['- Collections/',
|
newCollection: ['- Collections/',
|
||||||
@ -166,13 +168,14 @@ var CollectionActions = actions.Actions({
|
|||||||
: this.saveCollection(collection)
|
: this.saveCollection(collection)
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// XXX do we actually need this???
|
/*/ XXX do we actually need this???
|
||||||
// ...a way to delete stuff from collections is to crop out
|
// ...a way to delete stuff from collections is to crop out
|
||||||
// and overwrite...
|
// and overwrite...
|
||||||
uncollect: ['- Collections/',
|
uncollect: ['- Collections/',
|
||||||
function(gids, collection){
|
function(gids, collection){
|
||||||
// XXX
|
// XXX
|
||||||
}],
|
}],
|
||||||
|
//*/
|
||||||
|
|
||||||
removeCollection: ['- Collections/',
|
removeCollection: ['- Collections/',
|
||||||
function(collection){
|
function(collection){
|
||||||
@ -198,7 +201,25 @@ module.Collection = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
actions: CollectionActions,
|
actions: CollectionActions,
|
||||||
|
|
||||||
handlers: [],
|
handlers: [
|
||||||
|
// maintain the .collection state...
|
||||||
|
// XXX not yet sure if this is the right way to go...
|
||||||
|
['loadCollection',
|
||||||
|
function(_, collection){
|
||||||
|
if(this.collections && collection in this.collections){
|
||||||
|
this.data.collection = this.location.collection = collection
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
['uncrop',
|
||||||
|
function(){
|
||||||
|
var collection = this.location.collection = this.data.collection
|
||||||
|
|
||||||
|
// cleanup...
|
||||||
|
if(collection == null){
|
||||||
|
delete this.location.collection
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -293,7 +314,7 @@ var UICollectionActions = actions.Actions({
|
|||||||
})
|
})
|
||||||
})],
|
})],
|
||||||
|
|
||||||
|
// Collections actions with collection selection...
|
||||||
// XXX should we warn the user when overwriting???
|
// XXX should we warn the user when overwriting???
|
||||||
saveAsCollection: ['Collections/$Save as collection...',
|
saveAsCollection: ['Collections/$Save as collection...',
|
||||||
widgets.uiDialog(function(){
|
widgets.uiDialog(function(){
|
||||||
@ -310,7 +331,6 @@ var UICollectionActions = actions.Actions({
|
|||||||
return this.browseCollections(function(title){
|
return this.browseCollections(function(title){
|
||||||
this.joinCollect(title) }) })],
|
this.joinCollect(title) }) })],
|
||||||
|
|
||||||
|
|
||||||
// XXX this is not used by metadata yet...
|
// XXX this is not used by metadata yet...
|
||||||
metadataSection: ['- Image/',
|
metadataSection: ['- Image/',
|
||||||
function(gid, make){
|
function(gid, make){
|
||||||
|
|||||||
@ -25,6 +25,14 @@ Object.get = function(obj, name, dfl){
|
|||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(Object.prototype, 'run', {
|
||||||
|
enumerable: false,
|
||||||
|
value: function(func){
|
||||||
|
var res = func ? func.call(this) : undefined
|
||||||
|
return res === undefined ? this : res
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
// Compact a sparse array...
|
// Compact a sparse array...
|
||||||
//
|
//
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user