From ff7e86f0b1eddd6669684dd6a91e49f01d48ce14 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 14 Feb 2017 00:23:41 +0300 Subject: [PATCH] now sort order can be cached (safe to remove) or saved... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/sort.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ui (gen4)/features/sort.js b/ui (gen4)/features/sort.js index 21069a68..54e3a9c3 100755 --- a/ui (gen4)/features/sort.js +++ b/ui (gen4)/features/sort.js @@ -370,9 +370,7 @@ module.SortActions = actions.Actions({ // saved sort order... } else if(this.data.sort_order && mode in this.data.sort_order){ - this.data.order = this.data.sort_order[mode].slice() - this.sortImages('update' + (reverse ? ' reverse' : '')) - this.data.sort_method = mode + this.loadOrder(mode, reverse) } else { this.sortImages(sort) @@ -381,13 +379,19 @@ module.SortActions = actions.Actions({ // XXX add drop/load actions... saveOrder: ['- Sort/', - function(method){ - method = method || this.data.sort_method - - if(method){ + function(title){ + if(title){ var cache = this.data.sort_order = this.data.sort_order || {} - - cache[method] = this.data.order.slice() + cache[title] = 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 } }],