2
0
mirror of https://github.com/thumbsup/thumbsup synced 2024-11-05 12:01:04 +00:00

Fix sorting of albums & media

This commit is contained in:
Romain 2016-10-26 08:30:08 +11:00
parent 3dd51841ff
commit 6d162bd110

View File

@ -34,8 +34,8 @@ function Album(opts) {
Album.prototype.finalize = function(options) {
options = _.defaults(options, {
sortAlbumsBy: 'date',
sortMediaBy: 'date'
sortAlbums: 'date',
sortMedia: 'date'
});
// is this the top-level album?
this.home = this.depth === 0;
@ -86,8 +86,8 @@ Album.prototype.calculateSummary = function() {
};
Album.prototype.sort = function(options) {
this.files = _.sortBy(this.files, SORT_MEDIA_BY[options.sortMediaBy]);
this.albums = _.sortBy(this.albums, SORT_ALBUMS_BY[options.sortAlbumsBy]);
this.files = _.sortBy(this.files, SORT_MEDIA_BY[options.sortMedia]);
this.albums = _.sortBy(this.albums, SORT_ALBUMS_BY[options.sortAlbums]);
this.albums.forEach(function(nested) {
nested.sort(options);
});