mirror of
https://github.com/danbee/mpd-client
synced 2025-03-04 08:39:09 +00:00
43 lines
802 B
JavaScript
43 lines
802 B
JavaScript
can.Component.extend({
|
|
|
|
tag: 'mpd-panel-albums',
|
|
|
|
template: can.view('views/panels/albums.mustache'),
|
|
|
|
scope: {
|
|
depth: "@",
|
|
artist: "@",
|
|
title: function() {
|
|
if (this.artist !== undefined) {
|
|
return this.artist;
|
|
}
|
|
else {
|
|
return 'Albums';
|
|
}
|
|
}
|
|
},
|
|
|
|
events: {
|
|
init: function() {
|
|
var self = this;
|
|
Album.findAll({ artist: this.scope.artist }, function(data) {
|
|
self.scope.attr('items', data);
|
|
self.element.trigger('switchPanel', self.scope.depth);
|
|
});
|
|
}
|
|
},
|
|
|
|
helpers: {
|
|
link: function(item) {
|
|
return can.route.link(item.title, {
|
|
type: 'library',
|
|
show: 'songs',
|
|
artist: item.artist,
|
|
album: item.title,
|
|
depth: +this.depth + 1
|
|
});
|
|
},
|
|
}
|
|
|
|
});
|