mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
refactoring collection serialization...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
46dc51076f
commit
7f52830f61
@ -662,7 +662,8 @@ core.ImageGridFeatures.Feature({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// images (full)...
|
// images (full)...
|
||||||
if(changes === true || changes.images === true){
|
if(res.raw.images
|
||||||
|
&& (changes === true || changes.images === true)){
|
||||||
res.index.images = res.raw.images
|
res.index.images = res.raw.images
|
||||||
|
|
||||||
// images-diff...
|
// images-diff...
|
||||||
|
|||||||
@ -1110,6 +1110,7 @@ module.Collection = core.ImageGridFeatures.Feature({
|
|||||||
// ...use this as a base for collection serialization...
|
// ...use this as a base for collection serialization...
|
||||||
['prepareIndexForWrite',
|
['prepareIndexForWrite',
|
||||||
function(res, _, full){
|
function(res, _, full){
|
||||||
|
var that = this
|
||||||
var changed = full == true
|
var changed = full == true
|
||||||
|| res.changes === true
|
|| res.changes === true
|
||||||
|| res.changes.collections
|
|| res.changes.collections
|
||||||
@ -1144,13 +1145,16 @@ module.Collection = core.ImageGridFeatures.Feature({
|
|||||||
Object.keys(raw)
|
Object.keys(raw)
|
||||||
.forEach(function(key){ metadata[key] = raw[key] })
|
.forEach(function(key){ metadata[key] = raw[key] })
|
||||||
|
|
||||||
// XXX use .prepareIndexForWrite(.., full) for this...
|
raw.date = res.date
|
||||||
// XXX pass the date...
|
// XXX set changes???
|
||||||
// collections/<gid>/data
|
// XXX would be nice to have collections' .tags here... (???)
|
||||||
if(metadata.data){
|
var prepared = that.prepareIndexForWrite(raw, full).index
|
||||||
res.index[path +'/data'] = metadata.data
|
|
||||||
delete metadata.data
|
Object.keys(prepared)
|
||||||
}
|
.forEach(function(key){
|
||||||
|
res.index[path +'/'+ key] = prepared[key]
|
||||||
|
delete metadata[key]
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
|||||||
@ -154,7 +154,7 @@ var IndexFormatActions = actions.Actions({
|
|||||||
: null
|
: null
|
||||||
changes = changes === null ? true : changes
|
changes = changes === null ? true : changes
|
||||||
return {
|
return {
|
||||||
date: Date.timeStamp(),
|
date: json.date || Date.timeStamp(),
|
||||||
changes: changes,
|
changes: changes,
|
||||||
raw: json,
|
raw: json,
|
||||||
index: {},
|
index: {},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user