added collection rename + minor fix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-09-24 18:42:03 +03:00
parent 2827e9e679
commit 9ba099f79d

View File

@ -544,6 +544,23 @@ var CollectionActions = actions.Actions({
this.collectionRemoved(collection) this.collectionRemoved(collection)
} }
}], }],
// XXX do we need this???
renameCollection: ['- Collections/',
function(from, to){
if(from == MAIN_COLLECTION_TITLE
|| to == MAIN_COLLECTION_TITLE
|| (this.collections || {})[from] == null){
return
}
var order = this.collection_order
order.splice(order.indexOf(from), 1, to)
var data = this.collections[to] = this.collections[from]
delete this.collections[from]
data.title = to
}],
// Introspection... // Introspection...
@ -1360,7 +1377,7 @@ module.CollectionTags = core.ImageGridFeatures.Feature({
// they were changed only??? // they were changed only???
['prepareIndexForWrite', ['prepareIndexForWrite',
function(res, _, full){ function(res, _, full){
var raw = res.raw.collections var raw = res.raw.collections || {}
// NOTE: we are cheating here, we do not need to check // NOTE: we are cheating here, we do not need to check
// for changes as this is already taken care off by // for changes as this is already taken care off by
@ -1368,7 +1385,7 @@ module.CollectionTags = core.ImageGridFeatures.Feature({
// the stuff it created... // the stuff it created...
// XXX should we be a bit more atomic and save tags iff // XXX should we be a bit more atomic and save tags iff
// they were changed only??? // they were changed only???
Object.keys(this.collections || {}).forEach(function(title){ Object.keys(raw).forEach(function(title){
var path = 'collections/'+ raw[title].gid var path = 'collections/'+ raw[title].gid
var metadata = res.index[path + '/metadata'] var metadata = res.index[path + '/metadata']
@ -1599,6 +1616,8 @@ var UICollectionActions = actions.Actions({
})], })],
// XXX edit collection title here??? // XXX edit collection title here???
// ...also might need a collection editor dialog...
// XXX would be nice to make this nested (i.e. path list)...
browseCollections: ['Collections/$Collec$tions...', browseCollections: ['Collections/$Collec$tions...',
core.doc`Collection list... core.doc`Collection list...