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)...
|
||||
if(changes === true || changes.images === true){
|
||||
if(res.raw.images
|
||||
&& (changes === true || changes.images === true)){
|
||||
res.index.images = res.raw.images
|
||||
|
||||
// images-diff...
|
||||
|
||||
@ -1110,6 +1110,7 @@ module.Collection = core.ImageGridFeatures.Feature({
|
||||
// ...use this as a base for collection serialization...
|
||||
['prepareIndexForWrite',
|
||||
function(res, _, full){
|
||||
var that = this
|
||||
var changed = full == true
|
||||
|| res.changes === true
|
||||
|| res.changes.collections
|
||||
@ -1144,13 +1145,16 @@ module.Collection = core.ImageGridFeatures.Feature({
|
||||
Object.keys(raw)
|
||||
.forEach(function(key){ metadata[key] = raw[key] })
|
||||
|
||||
// XXX use .prepareIndexForWrite(.., full) for this...
|
||||
// XXX pass the date...
|
||||
// collections/<gid>/data
|
||||
if(metadata.data){
|
||||
res.index[path +'/data'] = metadata.data
|
||||
delete metadata.data
|
||||
}
|
||||
raw.date = res.date
|
||||
// XXX set changes???
|
||||
// XXX would be nice to have collections' .tags here... (???)
|
||||
var prepared = that.prepareIndexForWrite(raw, full).index
|
||||
|
||||
Object.keys(prepared)
|
||||
.forEach(function(key){
|
||||
res.index[path +'/'+ key] = prepared[key]
|
||||
delete metadata[key]
|
||||
})
|
||||
})
|
||||
}
|
||||
}],
|
||||
|
||||
@ -154,7 +154,7 @@ var IndexFormatActions = actions.Actions({
|
||||
: null
|
||||
changes = changes === null ? true : changes
|
||||
return {
|
||||
date: Date.timeStamp(),
|
||||
date: json.date || Date.timeStamp(),
|
||||
changes: changes,
|
||||
raw: json,
|
||||
index: {},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user