forked from 0x2620/pandora
fix reverse sort
This commit is contained in:
parent
05a0be5c99
commit
acee6e0382
1 changed files with 12 additions and 6 deletions
|
@ -464,10 +464,7 @@ pandora.ui.editPanel = function() {
|
||||||
'id', 'index', 'in', 'out', 'duration',
|
'id', 'index', 'in', 'out', 'duration',
|
||||||
'title', 'director', 'year', 'videoRatio'
|
'title', 'director', 'year', 'videoRatio'
|
||||||
].indexOf(key) > -1) {
|
].indexOf(key) > -1) {
|
||||||
edit.clips = Ox.sortBy(edit.clips, key);
|
sortBy(key);
|
||||||
if (sort[0].operator == '-') {
|
|
||||||
edit.clips.reverse();
|
|
||||||
}
|
|
||||||
updateDuration();
|
updateDuration();
|
||||||
callback(edit.clips);
|
callback(edit.clips);
|
||||||
} else {
|
} else {
|
||||||
|
@ -476,13 +473,22 @@ pandora.ui.editPanel = function() {
|
||||||
sort: sort
|
sort: sort
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
edit.clips.forEach(function(clip) {
|
edit.clips.forEach(function(clip) {
|
||||||
clip['sort'] = result.data.clips.indexOf(clip.id);
|
clip.sort = result.data.clips.indexOf(clip.id);
|
||||||
|
if (sort[0].operator == '-') {
|
||||||
|
clip.sort = -clip.sort;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
edit.clips = Ox.sortBy(edit.clips, 'sort');
|
sortBy('sort');
|
||||||
updateDuration();
|
updateDuration();
|
||||||
callback(edit.clips);
|
callback(edit.clips);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function sortBy(key) {
|
||||||
|
edit.clips = Ox.sortBy(edit.clips, key);
|
||||||
|
if (sort[0].operator == '-') {
|
||||||
|
edit.clips.reverse();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateDuration() {
|
function updateDuration() {
|
||||||
|
|
Loading…
Reference in a new issue