fix sort by year

This commit is contained in:
j 2014-02-10 10:53:45 +00:00
parent 0477a67f5a
commit 5c5102baf0

View file

@ -521,8 +521,9 @@ pandora.ui.editPanel = function(isEmbed) {
} }
function sortClips(callback) { function sortClips(callback) {
var sort = pandora.user.ui.editSort; var sort = pandora.user.ui.editSort,
var key = sort[0].key; key = sort[0].key,
index;
if (key == 'position') { if (key == 'position') {
key = 'in'; key = 'in';
} }
@ -531,6 +532,13 @@ pandora.ui.editPanel = function(isEmbed) {
'title', 'director', 'year', 'videoRatio' 'title', 'director', 'year', 'videoRatio'
].indexOf(key) > -1) { ].indexOf(key) > -1) {
sortBy(key); sortBy(key);
index = 0;
edit.clips.forEach(function(clip) {
clip.sort = index++;
if (sort[0].operator == '-') {
clip.sort = -clip.sort;
}
});
updateDuration(); updateDuration();
callback(edit.clips); callback(edit.clips);
} else { } else {
@ -550,10 +558,7 @@ pandora.ui.editPanel = function(isEmbed) {
}); });
} }
function sortBy(key) { function sortBy(key) {
edit.clips = Ox.sortBy(edit.clips, key); edit.clips = Ox.sortBy(edit.clips, sort[0].operator + key);
if (sort[0].operator == '-') {
edit.clips.reverse();
}
} }
} }