mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
file store format construction and loading framework is working, still need to refactor legacy code...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
3aa03faea6
commit
8e2c6945d8
@ -468,28 +468,34 @@ module.Sort = core.ImageGridFeatures.Feature({
|
|||||||
function(res, _, full){
|
function(res, _, full){
|
||||||
var c = this.changes
|
var c = this.changes
|
||||||
|
|
||||||
var save = function(attr){
|
;['sort_order', 'sort_cache']
|
||||||
if((full || c == null || c[attr]) && res.raw[attr]){
|
.forEach(function(attr){
|
||||||
// full save...
|
if((full || c == null || c[attr]) && res.raw.data[attr]){
|
||||||
if(full || c == null){
|
// full save...
|
||||||
res.index[attr] = res.raw[attr]
|
if(full || c == null){
|
||||||
|
res.index[attr] = res.raw.data[attr]
|
||||||
|
|
||||||
// build diff...
|
// build diff...
|
||||||
} else {
|
} else {
|
||||||
var diff = {}
|
var diff = {}
|
||||||
c[attr].forEach(function(k){ diff[k] = res.raw[attr][k] })
|
c[attr].forEach(function(k){
|
||||||
res.index[attr +'-diff'] = diff
|
diff[k] = res.raw.data[attr][k] })
|
||||||
|
res.index[attr +'-diff'] = diff
|
||||||
|
}
|
||||||
|
|
||||||
|
// cleanup...
|
||||||
|
delete res.index.data[attr]
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
|
||||||
|
|
||||||
save('sort_order')
|
|
||||||
save('sort_cache')
|
|
||||||
}],
|
}],
|
||||||
['prepareJSONForLoad',
|
['prepareJSONForLoad',
|
||||||
function(res){
|
function(res){
|
||||||
// XXX
|
['sort_order', 'sort_cache']
|
||||||
//res.data.sort_cache = res.sort_cache
|
.forEach(function(attr){
|
||||||
|
if(res[attr]){
|
||||||
|
res.data[attr] = res[attr]
|
||||||
|
}
|
||||||
|
})
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// manage changes...
|
// manage changes...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user