cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-05-01 00:06:07 +03:00
parent 3b1a91a085
commit b4ae7360d2

View File

@ -52,8 +52,9 @@ module.SortActions = actions.Actions({
// NOTE: 'Manual' mode is set after .shiftImageLeft(..)/.shiftImageRight(..) // NOTE: 'Manual' mode is set after .shiftImageLeft(..)/.shiftImageRight(..)
// are called or when restoring a pre-existing .data.manual_order // are called or when restoring a pre-existing .data.manual_order
// via .toggleImageSort('Manual') // via .toggleImageSort('Manual')
// // NOTE: all sort methods are terminated with 'keep-position' so
// XXX need a natural way to reverse these... // as to prevent shuffling of images that are not usable with
// the previous methods in chain...
'sort-methods': { 'sort-methods': {
'none': '', 'none': '',
// NOTE: this is descending by default... // NOTE: this is descending by default...
@ -98,15 +99,17 @@ module.SortActions = actions.Actions({
return a - b return a - b
}, },
// this will sort items via their index... // This is specifically designed to terminate sort methods to prevent
// images that are not relevant to the previous order to stay in place
//
// XXX need to test how will this affect a set of images where part
// of the set is sortable an part is not...
'keep-position': function(a, b){ 'keep-position': function(a, b){
a = this.data.order.indexOf(a) a = this.data.order.indexOf(a)
b = this.data.order.indexOf(b) b = this.data.order.indexOf(b)
return a - b return a - b
}, },
'dummy': function(){ return 0 },
}, },
// Sort images... // Sort images...
// //
@ -156,11 +159,6 @@ module.SortActions = actions.Actions({
// //
// XXX would be nice to be able to sort a list of gids or a section // XXX would be nice to be able to sort a list of gids or a section
// of images... // of images...
// XXX sorting with partial images will throw the images that do not
// exist or the ones that do not have the right attrs all over
// the place...
// ...should we pool the "unknowns" to one side with their
// current order??
// XXX should this handle manual sort order??? // XXX should this handle manual sort order???
sortImages: ['- Edit|Sort/Sort images', sortImages: ['- Edit|Sort/Sort images',
function(method, reverse){ function(method, reverse){