now sort order can be cached (safe to remove) or saved...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-02-14 00:23:41 +03:00
parent c48529693b
commit ff7e86f0b1

View File

@ -370,9 +370,7 @@ module.SortActions = actions.Actions({
// saved sort order... // saved sort order...
} else if(this.data.sort_order } else if(this.data.sort_order
&& mode in this.data.sort_order){ && mode in this.data.sort_order){
this.data.order = this.data.sort_order[mode].slice() this.loadOrder(mode, reverse)
this.sortImages('update' + (reverse ? ' reverse' : ''))
this.data.sort_method = mode
} else { } else {
this.sortImages(sort) this.sortImages(sort)
@ -381,13 +379,19 @@ module.SortActions = actions.Actions({
// XXX add drop/load actions... // XXX add drop/load actions...
saveOrder: ['- Sort/', saveOrder: ['- Sort/',
function(method){ function(title){
method = method || this.data.sort_method if(title){
if(method){
var cache = this.data.sort_order = this.data.sort_order || {} var cache = this.data.sort_order = this.data.sort_order || {}
cache[title] = this.data.order.slice()
cache[method] = this.data.order.slice() }
}],
loadOrder: ['- Srot/',
function(title, reverse){
var order = (this.data.sort_order || {})[title]
if(order){
this.data.order = order.slice()
this.sortImages('update' + (reverse ? ' reverse' : ''))
this.data.sort_method = mode
} }
}], }],