mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
added default collections + some tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e63041c570
commit
70aa79d80b
@ -56,10 +56,6 @@ var CollectionActions = actions.Actions({
|
|||||||
// 'main' - save crop state for main state only
|
// 'main' - save crop state for main state only
|
||||||
// 'none' - do not save crop state
|
// 'none' - do not save crop state
|
||||||
'collection-save-crop-state': 'all',
|
'collection-save-crop-state': 'all',
|
||||||
|
|
||||||
// XXX add default collection list to config...
|
|
||||||
'default-collections': [
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Format:
|
// Format:
|
||||||
@ -468,7 +464,7 @@ var CollectionActions = actions.Actions({
|
|||||||
NOTE: when removing the currently loaded collection this will
|
NOTE: when removing the currently loaded collection this will
|
||||||
just remove it from .collections and do nothing...`,
|
just remove it from .collections and do nothing...`,
|
||||||
function(collection){
|
function(collection){
|
||||||
if(collection == MAIN_COLLECTION_TITLE){
|
if(!this.collections || collection == MAIN_COLLECTION_TITLE){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
delete this.collections[collection]
|
delete this.collections[collection]
|
||||||
@ -498,6 +494,10 @@ var CollectionActions = actions.Actions({
|
|||||||
}
|
}
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
|
if(!this.collections || !(collection in this.collections)){
|
||||||
|
this.newCollection(collection)
|
||||||
|
}
|
||||||
|
|
||||||
gids = gids == 'loaded' ? this.data.getImages('loaded')
|
gids = gids == 'loaded' ? this.data.getImages('loaded')
|
||||||
: gids instanceof Array ? gids
|
: gids instanceof Array ? gids
|
||||||
: [gids]
|
: [gids]
|
||||||
@ -542,6 +542,11 @@ var CollectionActions = actions.Actions({
|
|||||||
if(collection == null || collection == MAIN_COLLECTION_TITLE){
|
if(collection == null || collection == MAIN_COLLECTION_TITLE){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this.collections || !(collection in this.collections)){
|
||||||
|
this.newCollection(collection)
|
||||||
|
}
|
||||||
|
|
||||||
// if only collection is given, reset align to null...
|
// if only collection is given, reset align to null...
|
||||||
align = align === collection ? null : align
|
align = align === collection ? null : align
|
||||||
|
|
||||||
@ -559,7 +564,10 @@ var CollectionActions = actions.Actions({
|
|||||||
{browseMode: function(){ return !this.collection && 'disabled' }},
|
{browseMode: function(){ return !this.collection && 'disabled' }},
|
||||||
function(gids, collection){
|
function(gids, collection){
|
||||||
collection = collection || this.collection
|
collection = collection || this.collection
|
||||||
if(collection == null || collection == MAIN_COLLECTION_TITLE){
|
if(collection == null
|
||||||
|
|| collection == MAIN_COLLECTION_TITLE
|
||||||
|
|| !this.collections
|
||||||
|
|| !(collection in this.collections)){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1081,6 +1089,8 @@ module.CollectionTags = core.ImageGridFeatures.Feature({
|
|||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
// XXX add UI...
|
// XXX add UI...
|
||||||
|
// XXX removing items from auto-collection has no effect as it will be
|
||||||
|
// reconstructed on next load -- is this the right way to go???
|
||||||
var AutoCollectionsActions = actions.Actions({
|
var AutoCollectionsActions = actions.Actions({
|
||||||
collectionAutoLevelLoader: ['- Collections/',
|
collectionAutoLevelLoader: ['- Collections/',
|
||||||
core.doc`
|
core.doc`
|
||||||
@ -1261,8 +1271,40 @@ module.AutoCollections = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
// XXX show collections in image metadata...
|
// XXX show collections in image metadata... (???)
|
||||||
var UICollectionActions = actions.Actions({
|
var UICollectionActions = actions.Actions({
|
||||||
|
config: {
|
||||||
|
|
||||||
|
// XXX should we add reasonable defaults here???
|
||||||
|
'default-collections': null,
|
||||||
|
},
|
||||||
|
|
||||||
|
editDefaultCollections: ['Interface/Edit default collections...',
|
||||||
|
widgets.makeUIDialog(function(action){
|
||||||
|
|
||||||
|
var defaults =
|
||||||
|
this.config['default-collections'] =
|
||||||
|
(this.config['default-collections'] || []).slice()
|
||||||
|
|
||||||
|
return browse.makeLister(null,
|
||||||
|
function(path, make){
|
||||||
|
make.EditableList(defaults,
|
||||||
|
{
|
||||||
|
unique: true,
|
||||||
|
sortable: 'y',
|
||||||
|
|
||||||
|
normalize: function(title){
|
||||||
|
return title.trim() },
|
||||||
|
check: function(title){
|
||||||
|
return title.length > 0
|
||||||
|
&& title != MAIN_COLLECTION_TITLE },
|
||||||
|
})
|
||||||
|
}, {
|
||||||
|
cls: 'collection-list',
|
||||||
|
})
|
||||||
|
})],
|
||||||
|
|
||||||
|
// XXX handle default collections...
|
||||||
browseCollections: ['Collections/$Collec$tions...',
|
browseCollections: ['Collections/$Collec$tions...',
|
||||||
core.doc`Collection list...
|
core.doc`Collection list...
|
||||||
|
|
||||||
@ -1272,6 +1314,8 @@ var UICollectionActions = actions.Actions({
|
|||||||
var that = this
|
var that = this
|
||||||
var to_remove = []
|
var to_remove = []
|
||||||
|
|
||||||
|
var defaults = this.config['default-collections']
|
||||||
|
|
||||||
return browse.makeLister(null,
|
return browse.makeLister(null,
|
||||||
function(path, make){
|
function(path, make){
|
||||||
var dialog = this
|
var dialog = this
|
||||||
@ -1282,6 +1326,12 @@ var UICollectionActions = actions.Actions({
|
|||||||
})
|
})
|
||||||
|
|
||||||
var openHandler = function(_, title){
|
var openHandler = function(_, title){
|
||||||
|
// create collection if it does not exist...
|
||||||
|
if(!that.collections
|
||||||
|
|| !(title in that.collections)){
|
||||||
|
that.newCollection(title)
|
||||||
|
}
|
||||||
|
|
||||||
var gid = that.current
|
var gid = that.current
|
||||||
action ?
|
action ?
|
||||||
action.call(that, title)
|
action.call(that, title)
|
||||||
@ -1305,8 +1355,13 @@ var UICollectionActions = actions.Actions({
|
|||||||
//var collections = Object.keys(that.collections || {})
|
//var collections = Object.keys(that.collections || {})
|
||||||
var collections = that.collection_order = that.collection_order || []
|
var collections = that.collection_order = that.collection_order || []
|
||||||
|
|
||||||
|
if(defaults){
|
||||||
|
collections = collections.concat(defaults).unique()
|
||||||
|
}
|
||||||
|
|
||||||
// main collection...
|
// main collection...
|
||||||
!action && collections.indexOf(MAIN_COLLECTION_TITLE) < 0
|
!action
|
||||||
|
&& collections.indexOf(MAIN_COLLECTION_TITLE) < 0
|
||||||
&& make([
|
&& make([
|
||||||
MAIN_COLLECTION_TITLE,
|
MAIN_COLLECTION_TITLE,
|
||||||
],
|
],
|
||||||
@ -1360,14 +1415,14 @@ var UICollectionActions = actions.Actions({
|
|||||||
})
|
})
|
||||||
})],
|
})],
|
||||||
browseImageCollections: ['Collections|Image/Image $collections...',
|
browseImageCollections: ['Collections|Image/Image $collections...',
|
||||||
{dialogTitle: 'Image Collections...'},
|
|
||||||
widgets.makeUIDialog(function(gid){
|
widgets.makeUIDialog(function(gid){
|
||||||
var that = this
|
var that = this
|
||||||
gid = this.data.getImage(gid)
|
gid = this.data.getImage(gid)
|
||||||
|
|
||||||
|
var defaults = this.config['default-collections']
|
||||||
|
|
||||||
var all
|
var all
|
||||||
var collections
|
var collections
|
||||||
|
|
||||||
var to_remove
|
var to_remove
|
||||||
|
|
||||||
return browse.makeLister(null,
|
return browse.makeLister(null,
|
||||||
@ -1382,6 +1437,10 @@ var UICollectionActions = actions.Actions({
|
|||||||
//all = Object.keys(that.collections || {})
|
//all = Object.keys(that.collections || {})
|
||||||
all = that.collection_order = that.collection_order || []
|
all = that.collection_order = that.collection_order || []
|
||||||
|
|
||||||
|
if(defaults){
|
||||||
|
all = all.concat(defaults).unique()
|
||||||
|
}
|
||||||
|
|
||||||
collections = collections
|
collections = collections
|
||||||
|| that.inCollections(gid || null)
|
|| that.inCollections(gid || null)
|
||||||
|
|
||||||
|
|||||||
@ -1182,6 +1182,8 @@ var BrowseActionsActions = actions.Actions({
|
|||||||
'Crop/-81:Uncrop all',
|
'Crop/-81:Uncrop all',
|
||||||
'Crop/-82:$Uncrop',
|
'Crop/-82:$Uncrop',
|
||||||
'Collec$tions',
|
'Collec$tions',
|
||||||
|
'Collections/-70:---',
|
||||||
|
'Collections/-90:.*remove.*',
|
||||||
'$Mark',
|
'$Mark',
|
||||||
//'Mark/-99:.*remove.*',
|
//'Mark/-99:.*remove.*',
|
||||||
'$Bookmark',
|
'$Bookmark',
|
||||||
|
|||||||
@ -608,6 +608,7 @@ var KeyboardPrototype = {
|
|||||||
// NOTE: to match several compatible handlers, pass a list of handlers,
|
// NOTE: to match several compatible handlers, pass a list of handlers,
|
||||||
// the result for each will be merged into one common list.
|
// the result for each will be merged into one common list.
|
||||||
//
|
//
|
||||||
|
// XXX drop/DROP/NEXT handling need more testing...
|
||||||
// XXX this and .handler(..) in part repeat handling dropped keys,
|
// XXX this and .handler(..) in part repeat handling dropped keys,
|
||||||
// can we unify this???
|
// can we unify this???
|
||||||
keys: function(handler){
|
keys: function(handler){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user