mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
cleanup and minor refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
8f8ed2d6c9
commit
a2cd1c3557
@ -21,13 +21,7 @@ var widgets = require('features/ui-widgets')
|
|||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
//
|
||||||
var MAIN_COLLECTION_TITLE = 'ALL'
|
|
||||||
|
|
||||||
// XXX things we need to do to collections:
|
|
||||||
// - 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.
|
||||||
@ -44,10 +38,16 @@ var MAIN_COLLECTION_TITLE = 'ALL'
|
|||||||
// - save - done
|
// - save - done
|
||||||
// - load - done
|
// - load - done
|
||||||
// - save/merge use...
|
// - save/merge use...
|
||||||
// XXX tag actions:
|
// XXX merge data -- collection/crop/all
|
||||||
// - .collectmarked(..)
|
// - vertical only
|
||||||
// - ...
|
// - horizontal only
|
||||||
// XXX selection/tag based .collect()/.uncollect() actions...
|
// - both
|
||||||
|
// XXX external / linked collections (.location)...
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
var MAIN_COLLECTION_TITLE = 'ALL'
|
||||||
|
|
||||||
// XXX undo...
|
// XXX undo...
|
||||||
var CollectionActions = actions.Actions({
|
var CollectionActions = actions.Actions({
|
||||||
config: {
|
config: {
|
||||||
@ -152,6 +152,34 @@ var CollectionActions = actions.Actions({
|
|||||||
return handlers
|
return handlers
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// Collection events...
|
||||||
|
//
|
||||||
|
collectionLoading: ['- Collections/',
|
||||||
|
core.doc`This is called by .loadCollection(..) or one of the
|
||||||
|
overloading actions when collection load is done...
|
||||||
|
|
||||||
|
The .pre phase is called just before the load and the .post phase
|
||||||
|
just after.
|
||||||
|
|
||||||
|
`,
|
||||||
|
core.notUserCallable(function(collection){
|
||||||
|
// This is the window resize event...
|
||||||
|
//
|
||||||
|
// Not for direct use.
|
||||||
|
})],
|
||||||
|
collectionUnloaded: ['- Collections/',
|
||||||
|
core.doc`This is called when unloading a collection.
|
||||||
|
`,
|
||||||
|
core.notUserCallable(function(collection){
|
||||||
|
// This is the window resize event...
|
||||||
|
//
|
||||||
|
// Not for direct use.
|
||||||
|
})],
|
||||||
|
|
||||||
|
|
||||||
|
// Collection life-cycle...
|
||||||
|
//
|
||||||
loadCollection: ['- Collections/',
|
loadCollection: ['- Collections/',
|
||||||
core.doc`Load collection...
|
core.doc`Load collection...
|
||||||
|
|
||||||
@ -316,30 +344,6 @@ var CollectionActions = actions.Actions({
|
|||||||
collection)
|
collection)
|
||||||
})
|
})
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// events...
|
|
||||||
collectionLoading: ['- Collections/',
|
|
||||||
core.doc`This is called by .loadCollection(..) or one of the
|
|
||||||
overloading actions when collection load is done...
|
|
||||||
|
|
||||||
The .pre phase is called just before the load and the .post phase
|
|
||||||
just after.
|
|
||||||
|
|
||||||
`,
|
|
||||||
core.notUserCallable(function(collection){
|
|
||||||
// This is the window resize event...
|
|
||||||
//
|
|
||||||
// Not for direct use.
|
|
||||||
})],
|
|
||||||
collectionUnloaded: ['- Collections/',
|
|
||||||
core.doc`This is called when unloading a collection.
|
|
||||||
`,
|
|
||||||
core.notUserCallable(function(collection){
|
|
||||||
// This is the window resize event...
|
|
||||||
//
|
|
||||||
// Not for direct use.
|
|
||||||
})],
|
|
||||||
|
|
||||||
// XXX should this call .loadCollection('!') when saving to current
|
// XXX should this call .loadCollection('!') when saving to current
|
||||||
// collection???
|
// collection???
|
||||||
// This would reaload the view to a consistent (just saved)
|
// This would reaload the view to a consistent (just saved)
|
||||||
@ -457,7 +461,6 @@ var CollectionActions = actions.Actions({
|
|||||||
}],
|
}],
|
||||||
newCollection: ['- Collections/',
|
newCollection: ['- Collections/',
|
||||||
function(collection){ return this.saveCollection(collection, 'empty') }],
|
function(collection){ return this.saveCollection(collection, 'empty') }],
|
||||||
// XXX should we do anything special if collection is loaded???
|
|
||||||
removeCollection: ['- Collections/',
|
removeCollection: ['- Collections/',
|
||||||
core.doc`
|
core.doc`
|
||||||
|
|
||||||
@ -470,6 +473,9 @@ var CollectionActions = actions.Actions({
|
|||||||
delete this.collections[collection]
|
delete this.collections[collection]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
||||||
|
// Introspection...
|
||||||
|
//
|
||||||
inCollections: ['- Image/',
|
inCollections: ['- Image/',
|
||||||
core.doc`Get list of collections containing item`,
|
core.doc`Get list of collections containing item`,
|
||||||
function(gid){
|
function(gid){
|
||||||
@ -483,6 +489,9 @@ var CollectionActions = actions.Actions({
|
|||||||
|| that.collections[c].data.getImage(gid)) })
|
|| that.collections[c].data.getImage(gid)) })
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
||||||
|
// Collection editing....
|
||||||
|
//
|
||||||
collect: ['- Collections/',
|
collect: ['- Collections/',
|
||||||
core.doc`Add items to collection
|
core.doc`Add items to collection
|
||||||
|
|
||||||
@ -782,7 +791,9 @@ var CollectionActions = actions.Actions({
|
|||||||
delete this.location.collection
|
delete this.location.collection
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
||||||
// Config and interface stuff...
|
// Config and interface stuff...
|
||||||
|
//
|
||||||
toggleCollectionCropRetention: ['Interface/Collection crop save mode',
|
toggleCollectionCropRetention: ['Interface/Collection crop save mode',
|
||||||
core.makeConfigToggler(
|
core.makeConfigToggler(
|
||||||
'collection-save-crop-state',
|
'collection-save-crop-state',
|
||||||
@ -1492,7 +1503,8 @@ var UICollectionActions = actions.Actions({
|
|||||||
})
|
})
|
||||||
})],
|
})],
|
||||||
|
|
||||||
// Collections actions with collection selection...
|
// Collection 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(){
|
||||||
@ -1581,6 +1593,7 @@ module.UICollection = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
// XXX collection id...
|
||||||
// XXX Things to try/do:
|
// XXX Things to try/do:
|
||||||
// - save collection on exit/write (?)
|
// - save collection on exit/write (?)
|
||||||
// - lazy load collections (load list, lazy-load data)
|
// - lazy load collections (load list, lazy-load data)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user